1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
| <template>
| <div class="scope">
| <div class="h">
| <el-tag size="small" effect="dark" disable-transitions>user-select</el-tag>
| <span>选择成员</span>
| </div>
|
| <div class="c">
| <el-button @click="open">预览</el-button>
| <demo-code :files="['crud/user-select.vue']" />
|
| <!-- 自定义表格组件 -->
| <cl-form ref="Form" />
| </div>
|
| <div class="f">
| <span class="date">2025-02-07</span>
| </div>
| </div>
| </template>
|
| <script setup lang="ts">
| import { useForm } from '@cool-vue/crud';
|
| const Form = useForm();
|
| function open() {
| Form.value?.open({
| title: '选择成员',
| items: [
| {
| label: '单选',
| prop: 'userId',
| component: {
| name: 'cl-user-select',
| props: {
| multiple: false,
| onChange(val) {
| console.log(val);
| }
| }
| },
| required: true
| },
| {
| label: '多选',
| prop: 'userIds',
| component: {
| name: 'cl-user-select',
| props: {
| multiple: true,
| onChange(val) {
| console.log(val);
| }
| }
| },
| required: true
| },
| {
| label: '回显',
| prop: 'testId',
| component: {
| name: 'cl-user-select',
| props: {
| // 【很重要】立即刷新
| immediate: true
| }
| }
| }
| ],
| form: {
| // 【很重要】手动设置值,实际根据接口返回
| testId: 2
| }
| });
| }
| </script>
|
|