File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
src/views/mp/components/wx-account-select Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ <template >
2
+ <el-form class =" -mb-15px" ref =" queryFormRef" :inline =" true" label-width =" 68px" >
3
+ <el-form-item label =" 公众号" prop =" accountId" >
4
+ <el-select
5
+ v-model =" accountId"
6
+ placeholder =" 请选择公众号"
7
+ class =" !w-240px"
8
+ @change =" accountChanged()"
9
+ >
10
+ <el-option v-for =" item in accountList" :key =" item.id" :label =" item.name" :value =" item.id" />
11
+ </el-select >
12
+ </el-form-item >
13
+ <el-form-item >
14
+ <slot name =" actions" ></slot >
15
+ </el-form-item >
16
+ </el-form >
17
+ </template >
18
+
19
+ <script setup name="WxAccountSelect">
20
+ import * as MpAccountApi from ' @/api/mp/account'
21
+ const accountId = ref ()
22
+ const accountList = ref ([])
23
+ const queryFormRef = ref ()
24
+
25
+ const emit = defineEmits ([' change' ])
26
+
27
+ onMounted (async () => {
28
+ handleQuery ()
29
+ })
30
+
31
+ const handleQuery = async () => {
32
+ const data = await MpAccountApi .getSimpleAccountList ()
33
+ accountList .value = data
34
+ // 默认选中第一个
35
+ if (accountList .value .length > 0 ) {
36
+ accountId .value = accountList .value [0 ].id
37
+ emit (' change' , accountId .value )
38
+ }
39
+ }
40
+
41
+ const accountChanged = () => {
42
+ emit (' change' , accountId .value )
43
+ }
44
+ </script >
You can’t perform that action at this time.
0 commit comments