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

pull/241/MERGE
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>