diff --git a/components.d.ts b/components.d.ts index 15b5916..296612b 100644 --- a/components.d.ts +++ b/components.d.ts @@ -10,7 +10,6 @@ export {} declare module '@vue/runtime-core' { export interface GlobalComponents { _index: typeof import('./src/core/components/_sample/_index.vue')['default'] - AAlert: typeof import('ant-design-vue/es')['Alert'] AAvatar: typeof import('ant-design-vue/es')['Avatar'] ABadge: typeof import('ant-design-vue/es')['Badge'] AButton: typeof import('ant-design-vue/es')['Button'] @@ -38,9 +37,7 @@ declare module '@vue/runtime-core' { AMenuItem: typeof import('ant-design-vue/es')['MenuItem'] AModal: typeof import('ant-design-vue/es')['Modal'] APagination: typeof import('ant-design-vue/es')['Pagination'] - APopconfirm: typeof import('ant-design-vue/es')['Popconfirm'] APopover: typeof import('ant-design-vue/es')['Popover'] - ARadio: typeof import('ant-design-vue/es')['Radio'] ARadioButton: typeof import('ant-design-vue/es')['RadioButton'] ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup'] ARow: typeof import('ant-design-vue/es')['Row'] diff --git a/src/pages/menuPages/banners/index.vue b/src/pages/menuPages/banners/index.vue index cc0f827..0931706 100644 --- a/src/pages/menuPages/banners/index.vue +++ b/src/pages/menuPages/banners/index.vue @@ -79,10 +79,21 @@ const typeList = ref([ {lable: 'بدون رویداد', value: null}, ]) -let content = '' +function parseBannerList(value: string | null | undefined): IBenefits[] { + if (!value) return [] + try { + const parsed = JSON.parse(value) + return Array.isArray(parsed) ? parsed : [] + } catch { + return [] + } +} function addRow() { - benefitsList.value.push({icon: null, show: true, caption: null, link: null, typeClick: null ,modalText:null}) + if (!Array.isArray(benefitsList.value)) { + benefitsList.value = [] + } + benefitsList.value.push({icon: null, show: true, caption: null, link: null, typeClick: null, modalText: null}) } function removeRow(index: number) { @@ -116,17 +127,9 @@ onMounted(async () => { try { const res = await getHeaderBannerConst() - if (res) { - if (res.length > 0) { - id = res[0].id || res[0].const_id || null - if (res[0].value) { - benefitsList.value = JSON.parse(res[0].value) - } - } else { - benefitsList.value = JSON.parse(res.value) - } - console.log(benefitsList.value) - + if (res?.length > 0) { + id = res[0].id || res[0].const_id || null + benefitsList.value = parseBannerList(res[0].value) } } catch (error) { console.error('خطا در دریافت بنرها:', error)