diff --git a/src/components/ImageUpload.vue b/src/components/ImageUpload.vue index 2bdbce9..5e78cda 100644 --- a/src/components/ImageUpload.vue +++ b/src/components/ImageUpload.vue @@ -39,13 +39,13 @@ const props = defineProps({ const emits = defineEmits(['on-success']) watch(() => props.imageUrl,(newVal) => { - if(newVal){ - if(newVal.url !== ''){ - file1.value = [{ ...newVal }] - }else{ - file1.value = [] - } + if (!newVal) return + if (newVal.url !== '') { + file1.value = [{...newVal}] + } else { + file1.value = [] } + },{ deep:true, immediate:true @@ -86,4 +86,4 @@ watch(() => props.imageUrl,(newVal) => { \ No newline at end of file + diff --git a/src/pages/article/components/ArticleDialog.vue b/src/pages/article/components/ArticleDialog.vue index 71e142c..c514f4c 100644 --- a/src/pages/article/components/ArticleDialog.vue +++ b/src/pages/article/components/ArticleDialog.vue @@ -60,9 +60,9 @@ const props = defineProps<{ article?: Article | {} categoryList: Category[] | [] }>() -const form = ref(null) -const header = computed(() => `${props.isEdit ? '编辑' : '创建'}${props.headerTitle || ''}`) -const confirmBtn = computed(() => (props.isEdit ? '保存' : '确定')) +const formRef = ref(null) +const headerText = computed(() => `${props.isEdit ? '编辑' : '创建'}${props.headerTitle || ''}`) +const confirmBtnText = computed(() => (props.isEdit ? '保存' : '确定')) const articleData: FormProps['data'] = reactive({ categoryName: '' }) const popupVisible = ref(false) diff --git a/src/pages/carousal/components/CarousalDialog.vue b/src/pages/carousal/components/CarousalDialog.vue index e92d8de..d7eca72 100644 --- a/src/pages/carousal/components/CarousalDialog.vue +++ b/src/pages/carousal/components/CarousalDialog.vue @@ -1,14 +1,13 @@ diff --git a/src/pages/carousal/index.vue b/src/pages/carousal/index.vue index 4c045b4..452ae42 100644 --- a/src/pages/carousal/index.vue +++ b/src/pages/carousal/index.vue @@ -40,12 +40,12 @@ const isEdit = ref(false) const currentTableData = ref(null) -const editClick = (row: object): void => { +const handleEdit = (row: object): void => { isEdit.value = true currentTableData.value = Object.assign({}, row) carousalDialogVisible.value = true } -const showClick = async (res: CarousalResult): Promise => { +const handleShow = async (res: CarousalResult): Promise => { if (res.status === 'active') { await inactiveCarousal(res.id) } else { @@ -53,7 +53,7 @@ const showClick = async (res: CarousalResult): Promise => { } await fetchData() } -const delClick = async (row: CarousalResult): Promise => { +const handleDelete = async (row: CarousalResult): Promise => { await deleteCarousal(row.id) await fetchData() } @@ -62,7 +62,6 @@ const handleCreateCarousal = (): void => { carousalDialogVisible.value = true currentTableData.value = {} } - const handleSuccessDialog = async (): Promise => { await fetchData() carousalDialogVisible.value = false @@ -109,11 +108,11 @@ const handleSuccessDialog = async (): Promise => { () -const form = ref(null) -const header = computed(() => `${props.category ? '编辑' : '创建'}${props.headerTitle || ''}`) -const confirmBtn = computed(() => (props.category ? '保存' : '确定')) +const formRef = ref(null) +const headerText = computed(() => `${props.category ? '编辑' : '创建'}${props.headerTitle || ''}`) +const confirmBtnText = computed(() => (props.category ? '保存' : '确定')) const categoryData: FormProps['data'] = reactive({ name: '', order: 1 }) const rules: FormProps['rules'] = { name: [