feat:【mall】diy editor 的 promotion-article 优化

This commit is contained in:
YunaiV
2025-11-01 12:09:10 +08:00
parent 0741ae4b63
commit 2e50526922
3 changed files with 17 additions and 22 deletions

View File

@@ -2,13 +2,11 @@ import type { ComponentStyle, DiyComponent } from '../../../util';
/** 营销文章属性 */
export interface PromotionArticleProperty {
// 文章编号
id: number;
// 组件样式
style: ComponentStyle;
id: number; // 文章编号
style: ComponentStyle; // 组件样式
}
// 定义组件
/** 定义组件 */
export const component = {
id: 'PromotionArticle',
name: '营销文章',

View File

@@ -9,10 +9,10 @@ import * as ArticleApi from '#/api/mall/promotion/article/index';
/** 营销文章 */
defineOptions({ name: 'PromotionArticle' });
// 定义属性
const props = defineProps<{ property: PromotionArticleProperty }>();
// 商品列表
const article = ref<MallArticleApi.Article>();
const props = defineProps<{ property: PromotionArticleProperty }>(); // 定义属性
const article = ref<MallArticleApi.Article>(); // 商品列表
watch(
() => props.property.id,
@@ -29,5 +29,3 @@ watch(
<template>
<div class="min-h-[30px]" v-dompurify-html="article?.content"></div>
</template>
<style scoped lang="scss"></style>

View File

@@ -12,18 +12,19 @@ import * as ArticleApi from '#/api/mall/promotion/article/index';
import ComponentContainerProperty from '../../component-container-property.vue';
// 营销文章属性面板
/** 营销文章属性面板 */
defineOptions({ name: 'PromotionArticleProperty' });
const props = defineProps<{ modelValue: PromotionArticleProperty }>();
const emit = defineEmits(['update:modelValue']);
const formData = useVModel(props, 'modelValue', emit);
// 文章列表
const articles = ref<MallArticleApi.Article[]>([]);
// 加载中
const loading = ref(false);
// 查询文章列表
const emit = defineEmits(['update:modelValue']);
const formData = useVModel(props, 'modelValue', emit);
const articles = ref<MallArticleApi.Article[]>([]); // 文章列表
const loading = ref(false); // 加载中
/** 查询文章列表 */
const queryArticleList = async (title?: string) => {
loading.value = true;
const { list } = await ArticleApi.getArticlePage({
@@ -35,7 +36,7 @@ const queryArticleList = async (title?: string) => {
loading.value = false;
};
// 初始化
/** 初始化 */
onMounted(() => {
queryArticleList();
});
@@ -65,5 +66,3 @@ onMounted(() => {
</ElForm>
</ComponentContainerProperty>
</template>
<style scoped lang="scss"></style>