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 { export interface PromotionArticleProperty {
// 文章编号 id: number; // 文章编号
id: number; style: ComponentStyle; // 组件样式
// 组件样式
style: ComponentStyle;
} }
// 定义组件 /** 定义组件 */
export const component = { export const component = {
id: 'PromotionArticle', id: 'PromotionArticle',
name: '营销文章', name: '营销文章',

View File

@@ -9,10 +9,10 @@ import * as ArticleApi from '#/api/mall/promotion/article/index';
/** 营销文章 */ /** 营销文章 */
defineOptions({ name: 'PromotionArticle' }); defineOptions({ name: 'PromotionArticle' });
// 定义属性
const props = defineProps<{ property: PromotionArticleProperty }>(); const props = defineProps<{ property: PromotionArticleProperty }>(); // 定义属性
// 商品列表
const article = ref<MallArticleApi.Article>(); const article = ref<MallArticleApi.Article>(); // 商品列表
watch( watch(
() => props.property.id, () => props.property.id,
@@ -29,5 +29,3 @@ watch(
<template> <template>
<div class="min-h-[30px]" v-dompurify-html="article?.content"></div> <div class="min-h-[30px]" v-dompurify-html="article?.content"></div>
</template> </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'; import ComponentContainerProperty from '../../component-container-property.vue';
// 营销文章属性面板 /** 营销文章属性面板 */
defineOptions({ name: 'PromotionArticleProperty' }); defineOptions({ name: 'PromotionArticleProperty' });
const props = defineProps<{ modelValue: PromotionArticleProperty }>(); const props = defineProps<{ modelValue: PromotionArticleProperty }>();
const emit = defineEmits(['update:modelValue']);
const formData = useVModel(props, 'modelValue', emit);
// 文章列表
const articles = ref<MallArticleApi.Article[]>([]);
// 加载中 const emit = defineEmits(['update:modelValue']);
const loading = ref(false);
// 查询文章列表 const formData = useVModel(props, 'modelValue', emit);
const articles = ref<MallArticleApi.Article[]>([]); // 文章列表
const loading = ref(false); // 加载中
/** 查询文章列表 */
const queryArticleList = async (title?: string) => { const queryArticleList = async (title?: string) => {
loading.value = true; loading.value = true;
const { list } = await ArticleApi.getArticlePage({ const { list } = await ArticleApi.getArticlePage({
@@ -35,7 +36,7 @@ const queryArticleList = async (title?: string) => {
loading.value = false; loading.value = false;
}; };
// 初始化 /** 初始化 */
onMounted(() => { onMounted(() => {
queryArticleList(); queryArticleList();
}); });
@@ -65,5 +66,3 @@ onMounted(() => {
</ElForm> </ElForm>
</ComponentContainerProperty> </ComponentContainerProperty>
</template> </template>
<style scoped lang="scss"></style>