39 lines
853 B
JavaScript
39 lines
853 B
JavaScript
// modules/ui.js
|
|
import { ref } from 'vue';
|
|
|
|
// Tab 切换
|
|
export const activeTab = ref('proxies');
|
|
export function switchTab(tab) {
|
|
activeTab.value = tab;
|
|
}
|
|
|
|
// 弹窗控制
|
|
export const dialogVisible = ref(false);
|
|
export const dialogMode = ref('add');
|
|
export const dialogForm = ref({
|
|
id: null,
|
|
name: '',
|
|
type: 'tcp',
|
|
localIP: '',
|
|
localPort: 0,
|
|
remotePort: 0,
|
|
});
|
|
|
|
export function openAddDialog() {
|
|
dialogMode.value = 'add';
|
|
dialogForm.value = { id: null, name: '', type: 'tcp', localIP: '', localPort: 0, remotePort: 0 };
|
|
dialogVisible.value = true;
|
|
}
|
|
|
|
export function openEditDialog(proxy) {
|
|
dialogMode.value = 'edit';
|
|
dialogForm.value = { ...proxy };
|
|
dialogVisible.value = true;
|
|
}
|
|
|
|
export function closeDialog() {
|
|
dialogVisible.value = false;
|
|
}
|
|
|
|
// 搜索
|
|
export const searchKeyword = ref(''); |