From 5a9f60414413a3fbaf59400c0c850b6582609461 Mon Sep 17 00:00:00 2001 From: sws <1141121512@qq.com> Date: Fri, 30 Aug 2024 09:42:56 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=B5=8B=E8=AF=95=E4=BC=98=E5=8C=96=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20sws=202024-08-29?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/model-article-list/index.vue | 50 ++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/components/model-article-list/index.vue b/src/components/model-article-list/index.vue index a272395d..0d9dc759 100644 --- a/src/components/model-article-list/index.vue +++ b/src/components/model-article-list/index.vue @@ -91,6 +91,31 @@ const default_data_list: ArticleList = { new_title: '测试文章标题', new_cover: [], }; +const get_auto_data_list = async (new_content: any) => { + const { category, number, sort, sort_rules, is_cover } = new_content; + const new_data = { + article_keywords: '', + article_category_ids: category.join(','), + article_order_by_type: sort, + article_order_by_rule: sort_rules, + article_number: number, + article_is_cover: is_cover ? 1 : 0, + }; + const res = await ArticleAPI.getAutoList(new_data); + if (!isEmpty(res.data)) { + data_list.value = []; + res.data.forEach((child: any) => { + data_list.value.push({ + id: get_math(), + new_title: '', + new_cover: [], + data: child, + }); + }); + } else { + data_list.value = Array(4).fill(default_data_list); + } +}; watch( props.value, (newVal, oldValue) => { @@ -160,31 +185,6 @@ const article_theme_class = computed(() => { } return `style${article_theme.value}`; }); -const get_auto_data_list = async (new_content: any) => { - const { category, number, sort, sort_rules, is_cover } = new_content; - const new_data = { - article_keywords: '', - article_category_ids: category.join(','), - article_order_by_type: sort, - article_order_by_rule: sort_rules, - article_number: number, - article_is_cover: is_cover ? 1 : 0, - }; - const res = await ArticleAPI.getAutoList(new_data); - if (!isEmpty(res.data)) { - data_list.value = []; - res.data.forEach((child: any) => { - data_list.value.push({ - id: get_math(), - new_title: '', - new_cover: [], - data: child, - }); - }); - } else { - data_list.value = Array(4).fill(default_data_list); - } -};