Initial commit

This commit is contained in:
Cain 2025-03-12 19:24:53 +08:00
parent e8b375c21c
commit fc64781e38

View File

@ -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">