From f3a05fd498c06ad4b3c19751bc5d0fb27d565e45 Mon Sep 17 00:00:00 2001 From: sws <1141121512@qq.com> Date: Wed, 21 Aug 2024 18:59:52 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=96=87=E7=AB=A0=E6=8E=A5=E5=8F=A3=E8=81=94?= =?UTF-8?q?=E8=B0=83=20sws=202024-08-21?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/model-article-list/index.vue | 18 ++++- .../model-article-list-content.vue | 78 +++---------------- 2 files changed, 24 insertions(+), 72 deletions(-) diff --git a/src/components/model-article-list/index.vue b/src/components/model-article-list/index.vue index 5e209c1f..3004aa16 100644 --- a/src/components/model-article-list/index.vue +++ b/src/components/model-article-list/index.vue @@ -38,9 +38,12 @@ const props = defineProps({ const error_img = ref('width:50px;padding:10px;'); const style = ref(''); const style_container = ref(''); +interface linkObj { + cover?: string; +} interface ArticleList { id: number | string; - link: object; + link: linkObj; new_title: string; new_url: uploadList[]; } @@ -73,6 +76,12 @@ const article_spacing_children = ref(''); const article_item_width = ref('50%'); const article_style = ref({}); +const default_article_list: ArticleList = { + id: 0, + link: {}, + new_title: '标题', + new_url: [], +}; watch( props.value, (newVal, oldValue) => { @@ -80,7 +89,11 @@ watch( const new_content = newVal?.content; const new_style = newVal?.style; // 内容 - article_list.value = new_content.article_list; + if (new_content.article_list.length == 0) { + article_list.value = Array(4).fill(default_article_list); + } else { + article_list.value = new_content.article_list; + } article_type.value = new_content.article_style; is_show.value = new_content.is_show; is_img_show.value = new_content.is_img_show; @@ -115,7 +128,6 @@ watch( { immediate: true, deep: true } ); const article_type_class = computed(() => { - // article_type == '1' ? '' : article_type == '0' ? '' : '' switch (article_type.value) { case '0': return 'style2 flex-col'; diff --git a/src/components/model-article-list/model-article-list-content.vue b/src/components/model-article-list/model-article-list-content.vue index 657aa54a..590f8f84 100644 --- a/src/components/model-article-list/model-article-list-content.vue +++ b/src/components/model-article-list/model-article-list-content.vue @@ -13,13 +13,13 @@
文章设置
- + {{ item.name }}