Initial commit
This commit is contained in:
parent
e8b375c21c
commit
fc64781e38
@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { computed, reactive, watch, ref } from 'vue';
|
||||
import { useClipboard } from '@vueuse/core';
|
||||
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
|
||||
import OperateDrawer from '@/components/common/operate-drawer.vue';
|
||||
@ -28,6 +28,11 @@ interface Emits {
|
||||
(e: 'submitted'): void;
|
||||
}
|
||||
|
||||
const categoryTypeOptions = ref([
|
||||
{ value: '1', label: '网站' },
|
||||
{ value: '2', label: '文献' }
|
||||
]);
|
||||
|
||||
const emit = defineEmits<Emits>();
|
||||
// 使用剪贴板功能
|
||||
const { copy, isSupported } = useClipboard();
|
||||
@ -89,6 +94,14 @@ function handleUpdateModelWhenEdit() {
|
||||
console.log(model);
|
||||
}
|
||||
}
|
||||
// 监听抽屉的可见性,当抽屉打开时,更新字典
|
||||
function handleUpdateDictWhenEdit() {
|
||||
categoryTypeOptions.value = [
|
||||
{ value: '1', label: '网站' },
|
||||
{ value: '2', label: '文献666' }
|
||||
];
|
||||
}
|
||||
|
||||
// 关闭抽屉
|
||||
function closeDrawer() {
|
||||
visible.value = false;
|
||||
@ -119,6 +132,7 @@ async function handleSubmit() {
|
||||
watch(visible, () => {
|
||||
if (visible.value) {
|
||||
handleUpdateModelWhenEdit();
|
||||
handleUpdateDictWhenEdit();
|
||||
restoreValidation();
|
||||
}
|
||||
});
|
||||
@ -136,11 +150,6 @@ async function handleCopy(source: string) {
|
||||
await copy(source);
|
||||
window.$message?.success('复制成功');
|
||||
}
|
||||
|
||||
const categoryTypeOptions = [
|
||||
{ value: '1', label: '网站' },
|
||||
{ value: '2', label: '文献' }
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -164,8 +173,12 @@ const categoryTypeOptions = [
|
||||
</NFormItem>
|
||||
|
||||
<NFormItem :label="$t('page.category.form.categoryType')" path="type">
|
||||
<NSelect v-model:value="model.type" :placeholder="$t('page.category.form.categoryType')"
|
||||
:options="categoryTypeOptions" clearable />
|
||||
<NSelect
|
||||
v-model:value="model.type"
|
||||
:placeholder="$t('page.category.form.categoryType')"
|
||||
:options="categoryTypeOptions"
|
||||
clearable
|
||||
/>
|
||||
</NFormItem>
|
||||
|
||||
<!-- <NFormItem :label="$t('page.category.form.categoryType')" path="type">
|
||||
|
Loading…
Reference in New Issue
Block a user