diff --git a/admin/src/api/decoration.ts b/admin/src/api/decoration.ts index 22dc4d93..1ecb0cfb 100644 --- a/admin/src/api/decoration.ts +++ b/admin/src/api/decoration.ts @@ -2,7 +2,7 @@ import request from '@/utils/request' // 页面装修详情 export function getDecoratePages(params: any) { - return request.get({ url: '/decorate/pages/detail', params }) + return request.get({ url: '/decorate/pages/detail', params }, { ignoreCancelToken: true }) } // 页面装修保存 diff --git a/admin/src/components/link/custom-link.vue b/admin/src/components/link/custom-link.vue index 6aff0e58..23f90536 100644 --- a/admin/src/components/link/custom-link.vue +++ b/admin/src/components/link/custom-link.vue @@ -1,5 +1,5 @@ @@ -24,36 +32,60 @@ import CustomLink from './custom-link.vue' const props = defineProps({ modelValue: { - type: Object as PropType + type: Object as PropType, + required: true } }) const emit = defineEmits<{ (event: 'update:modelValue', value: any): void }>() -const activeLink = computed({ - get() { - return props.modelValue - }, - set(value) { - emit('update:modelValue', value) - } -}) const menus = ref([ { name: '商城页面', - type: LinkTypeEnum.SHOP_PAGES + type: LinkTypeEnum.SHOP_PAGES, + link: {} }, { name: '自定义链接', - type: LinkTypeEnum.CUSTOM_LINK + type: LinkTypeEnum.CUSTOM_LINK, + link: {} } ]) + +const activeLink = computed({ + get() { + return menus.value.find((item) => item.type == activeMenu.value)?.link as Link + }, + set(value) { + menus.value.forEach((item) => { + if (item.type == activeMenu.value) { + item.link = value + } + }) + } +}) + const activeMenu = ref(LinkTypeEnum.SHOP_PAGES) const handleSelect = (index: string) => { activeMenu.value = index } + +const updateLink = (value: any) => { + emit('update:modelValue', value) +} + +watch( + () => props.modelValue, + (value) => { + activeMenu.value = value.type + activeLink.value = value + }, + { + immediate: true + } +)