提交 | 用户 | 时间
|
820397
|
1 |
<template> |
H |
2 |
<ComponentContainerProperty v-model="formData.style"> |
|
3 |
<el-form label-width="40px" :model="formData"> |
|
4 |
<el-form-item label="文章" prop="id"> |
|
5 |
<el-select |
|
6 |
v-model="formData.id" |
|
7 |
placeholder="请选择文章" |
|
8 |
class="w-full" |
|
9 |
filterable |
|
10 |
remote |
|
11 |
:remote-method="queryArticleList" |
|
12 |
:loading="loading" |
|
13 |
> |
|
14 |
<el-option |
|
15 |
v-for="article in articles" |
|
16 |
:key="article.id" |
|
17 |
:label="article.title" |
|
18 |
:value="article.id" |
|
19 |
/> |
|
20 |
</el-select> |
|
21 |
</el-form-item> |
|
22 |
</el-form> |
|
23 |
</ComponentContainerProperty> |
|
24 |
</template> |
|
25 |
|
|
26 |
<script setup lang="ts"> |
|
27 |
import { PromotionArticleProperty } from './config' |
|
28 |
import { usePropertyForm } from '@/components/DiyEditor/util' |
|
29 |
import * as ArticleApi from '@/api/mall/promotion/article/index' |
|
30 |
|
|
31 |
// 营销文章属性面板 |
|
32 |
defineOptions({ name: 'PromotionArticleProperty' }) |
|
33 |
|
|
34 |
const props = defineProps<{ modelValue: PromotionArticleProperty }>() |
|
35 |
const emit = defineEmits(['update:modelValue']) |
|
36 |
const { formData } = usePropertyForm(props.modelValue, emit) |
|
37 |
// 文章列表 |
|
38 |
const articles = ref<ArticleApi.ArticleVO>([]) |
|
39 |
|
|
40 |
// 加载中 |
|
41 |
const loading = ref(false) |
|
42 |
// 查询文章列表 |
|
43 |
const queryArticleList = async (title?: string) => { |
|
44 |
loading.value = true |
|
45 |
const { list } = await ArticleApi.getArticlePage({ title, pageSize: 10 }) |
|
46 |
articles.value = list |
|
47 |
loading.value = false |
|
48 |
} |
|
49 |
|
|
50 |
// 初始化 |
|
51 |
onMounted(() => { |
|
52 |
queryArticleList() |
|
53 |
}) |
|
54 |
</script> |
|
55 |
|
|
56 |
<style scoped lang="scss"></style> |