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="demo-upsert">
| <cl-upsert ref="upsertRef" :items="items" :dialog="dialog" />
| </div>
| </template>
|
| <script lang="ts">
| import { UpsertItem, UpsertRef } from "@cool-vue/crud/types";
| import { defineComponent, ref } from "vue";
|
| export default defineComponent({
| setup() {
| const upsertRef = ref<UpsertRef>();
|
| const dialog = {
| props: {
| fullscreen: false,
| width: "1200px"
| }
| };
|
| const items = ref<UpsertItem[]>([
| {
| label: "多图",
| prop: "imgs",
| component: {
| name: "cl-upload",
| props: {
| listType: "picture-card",
| multiple: true
| }
| }
| },
| {
| label: "文件",
| prop: "file",
| component: {
| name: "cl-upload",
| props: {
| listType: "text",
| limit: 1
| }
| }
| },
| {
| label: "开关",
| prop: "switch",
| component: {
| name: "el-switch"
| }
| },
| {
| label: "时间",
| prop: "time",
| hook: "datetimeRange",
| component: {
| name: "el-date-picker",
| props: {
| type: "datetimerange",
| valueFormat: "YYYY-MM-DD HH:mm:ss",
| defaultTime: [
| new Date(2000, 1, 1, 0, 0, 0),
| new Date(2000, 1, 1, 23, 59, 59)
| ]
| }
| }
| }
| ]);
|
| return {
| items,
| upsertRef,
| dialog
| };
| }
| });
| </script>
|
|