af-mobile-client-vue3 1.2.41 → 1.2.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/components/data/XCellList/index.vue +11 -9
- package/src/components/data/XFormGroup/doc/DeviceForm.vue +122 -0
- package/src/components/data/XFormGroup/doc/FormGroupDemo.vue +56 -0
- package/src/components/data/XFormGroup/doc/README.md +273 -0
- package/src/components/data/XFormGroup/doc/UserForm.vue +102 -0
- package/src/components/data/XFormGroup/index.vue +68 -19
- package/src/components/data/XFormItem/index.vue +18 -0
- package/src/views/component/XCellListView/index.vue +16 -9
- package/src/views/component/XFormView/index.vue +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "af-mobile-client-vue3",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.43",
|
|
5
5
|
"packageManager": "pnpm@10.12.3",
|
|
6
6
|
"description": "Vue + Vite component lib",
|
|
7
7
|
"engines": {
|
|
@@ -108,6 +108,6 @@
|
|
|
108
108
|
"commit-msg": "pnpm commitlint $1"
|
|
109
109
|
},
|
|
110
110
|
"lint-staged": {
|
|
111
|
-
"
|
|
111
|
+
"*.{js,ts,vue}": "eslint --fix"
|
|
112
112
|
}
|
|
113
113
|
}
|
|
@@ -210,15 +210,16 @@ function initComponent() {
|
|
|
210
210
|
}
|
|
211
211
|
configContent.value = result
|
|
212
212
|
// 扁平化 type=group 的 groupItems,保持顺序
|
|
213
|
-
|
|
214
|
-
result.formJson.
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
213
|
+
let flatFormJson = []
|
|
214
|
+
flatFormJson = result.formJson.filter(item => (!item.isOnlyAddOrEdit && item.type !== 'group') || (item.type === 'group' && item.groupItems.some(groupItem => !groupItem.isOnlyAddOrEdit)))
|
|
215
|
+
// result.formJson.forEach((item) => {
|
|
216
|
+
// if (item.type === 'group' && Array.isArray(item.groupItems)) {
|
|
217
|
+
// flatFormJson.push(...item.groupItems)
|
|
218
|
+
// }
|
|
219
|
+
// else {
|
|
220
|
+
// flatFormJson.push(item)
|
|
221
|
+
// }
|
|
222
|
+
// })
|
|
222
223
|
formQueryList.value = flatFormJson
|
|
223
224
|
console.log('formQueryList', formQueryList.value)
|
|
224
225
|
if (result.buttonState) {
|
|
@@ -528,6 +529,7 @@ function updateConditionAndRefresh(params: any) {
|
|
|
528
529
|
// 暴露方法给父组件
|
|
529
530
|
defineExpose({
|
|
530
531
|
updateConditionAndRefresh,
|
|
532
|
+
onRefresh,
|
|
531
533
|
})
|
|
532
534
|
</script>
|
|
533
535
|
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Cell as VanCell, CellGroup as VanCellGroup, Field as VanField, Switch as VanSwitch } from 'vant'
|
|
3
|
+
import { defineExpose, defineProps, onMounted, onUnmounted, ref } from 'vue'
|
|
4
|
+
|
|
5
|
+
interface DeviceFormProps {
|
|
6
|
+
setRef?: (refValue: any) => void
|
|
7
|
+
removeRef?: (refValue: any) => void
|
|
8
|
+
formGroupName?: string
|
|
9
|
+
formData?: any
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const props = withDefaults(defineProps<DeviceFormProps>(), {
|
|
13
|
+
setRef: () => {},
|
|
14
|
+
removeRef: () => {},
|
|
15
|
+
formGroupName: 'deviceInfo',
|
|
16
|
+
formData: () => ({}),
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const formData = ref({
|
|
20
|
+
deviceId: '',
|
|
21
|
+
deviceName: '',
|
|
22
|
+
deviceType: '',
|
|
23
|
+
status: 'active',
|
|
24
|
+
isOnline: false,
|
|
25
|
+
...props.formData,
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
async function validate() {
|
|
29
|
+
if (!formData.value.deviceId) {
|
|
30
|
+
throw new Error('设备ID不能为空')
|
|
31
|
+
}
|
|
32
|
+
if (!formData.value.deviceName) {
|
|
33
|
+
throw new Error('设备名称不能为空')
|
|
34
|
+
}
|
|
35
|
+
return Promise.resolve()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getFormData() {
|
|
39
|
+
return {
|
|
40
|
+
deviceId: formData.value.deviceId,
|
|
41
|
+
deviceName: formData.value.deviceName,
|
|
42
|
+
deviceType: formData.value.deviceType,
|
|
43
|
+
status: formData.value.status,
|
|
44
|
+
isOnline: formData.value.isOnline,
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function resetForm() {
|
|
49
|
+
formData.value = {
|
|
50
|
+
deviceId: '',
|
|
51
|
+
deviceName: '',
|
|
52
|
+
deviceType: '',
|
|
53
|
+
status: 'active',
|
|
54
|
+
isOnline: false,
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const exposeObj = {
|
|
59
|
+
validate,
|
|
60
|
+
getFormData,
|
|
61
|
+
resetForm,
|
|
62
|
+
formGroupName: props.formGroupName,
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
defineExpose(exposeObj)
|
|
66
|
+
|
|
67
|
+
onMounted(() => {
|
|
68
|
+
props.setRef(exposeObj)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
onUnmounted(() => {
|
|
72
|
+
props.removeRef(exposeObj)
|
|
73
|
+
})
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<template>
|
|
77
|
+
<div class="device-form">
|
|
78
|
+
<VanCellGroup inset>
|
|
79
|
+
<VanField
|
|
80
|
+
v-model="formData.deviceId"
|
|
81
|
+
label="设备ID"
|
|
82
|
+
placeholder="请输入设备ID"
|
|
83
|
+
:rules="[{ required: true, message: '请输入设备ID' }]"
|
|
84
|
+
/>
|
|
85
|
+
<VanField
|
|
86
|
+
v-model="formData.deviceName"
|
|
87
|
+
label="设备名称"
|
|
88
|
+
placeholder="请输入设备名称"
|
|
89
|
+
:rules="[{ required: true, message: '请输入设备名称' }]"
|
|
90
|
+
/>
|
|
91
|
+
<VanField
|
|
92
|
+
v-model="formData.deviceType"
|
|
93
|
+
label="设备类型"
|
|
94
|
+
placeholder="请输入设备类型"
|
|
95
|
+
/>
|
|
96
|
+
<VanCell title="设备状态">
|
|
97
|
+
<template #value>
|
|
98
|
+
<span :class="formData.status === 'active' ? 'text-success' : 'text-warning'">
|
|
99
|
+
{{ formData.status === 'active' ? '正常' : '异常' }}
|
|
100
|
+
</span>
|
|
101
|
+
</template>
|
|
102
|
+
</VanCell>
|
|
103
|
+
<VanCell title="在线状态">
|
|
104
|
+
<template #value>
|
|
105
|
+
<VanSwitch v-model="formData.isOnline" />
|
|
106
|
+
</template>
|
|
107
|
+
</VanCell>
|
|
108
|
+
</VanCellGroup>
|
|
109
|
+
</div>
|
|
110
|
+
</template>
|
|
111
|
+
|
|
112
|
+
<style scoped lang="less">
|
|
113
|
+
.device-form {
|
|
114
|
+
padding: 16px;
|
|
115
|
+
.text-success {
|
|
116
|
+
color: #07c160;
|
|
117
|
+
}
|
|
118
|
+
.text-warning {
|
|
119
|
+
color: #ff976a;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
</style>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import XFormGroup from '@af-mobile-client-vue3/components/data/XFormGroup/index.vue'
|
|
3
|
+
import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
|
|
4
|
+
import { showToast } from 'vant'
|
|
5
|
+
import { ref } from 'vue'
|
|
6
|
+
import DeviceForm from './DeviceForm.vue'
|
|
7
|
+
import UserForm from './UserForm.vue'
|
|
8
|
+
|
|
9
|
+
const configName = ref('complexFormGroup')
|
|
10
|
+
const serviceName = ref('af-apply')
|
|
11
|
+
const formData = ref({
|
|
12
|
+
userInfo: {},
|
|
13
|
+
deviceInfo: {},
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const formGroup = ref()
|
|
17
|
+
|
|
18
|
+
function handleSubmit(result: any) {
|
|
19
|
+
console.log('提交数据:', result)
|
|
20
|
+
showToast('提交成功')
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<NormalDataLayout title="表单组示例">
|
|
26
|
+
<template #layout_content>
|
|
27
|
+
<XFormGroup
|
|
28
|
+
ref="formGroup"
|
|
29
|
+
:config-name="configName"
|
|
30
|
+
:service-name="serviceName"
|
|
31
|
+
:group-form-data="formData"
|
|
32
|
+
mode="新增"
|
|
33
|
+
@submit="handleSubmit"
|
|
34
|
+
>
|
|
35
|
+
<!-- 用户信息插槽 -->
|
|
36
|
+
<template #user="{ setRef, removeRef, userFormData }">
|
|
37
|
+
<UserForm
|
|
38
|
+
:set-ref="setRef"
|
|
39
|
+
:remove-ref="removeRef"
|
|
40
|
+
form-group-name="userInfo"
|
|
41
|
+
:form-data="userFormData"
|
|
42
|
+
/>
|
|
43
|
+
</template>
|
|
44
|
+
<!-- 设备信息插槽 -->
|
|
45
|
+
<template #device="{ setRef, removeRef, deviceFormData }">
|
|
46
|
+
<DeviceForm
|
|
47
|
+
:set-ref="setRef"
|
|
48
|
+
:remove-ref="removeRef"
|
|
49
|
+
form-group-name="deviceInfo"
|
|
50
|
+
:form-data="deviceFormData"
|
|
51
|
+
/>
|
|
52
|
+
</template>
|
|
53
|
+
</XFormGroup>
|
|
54
|
+
</template>
|
|
55
|
+
</NormalDataLayout>
|
|
56
|
+
</template>
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# XFormGroup 表单组组件
|
|
2
|
+
|
|
3
|
+
## 组件概述
|
|
4
|
+
|
|
5
|
+
XFormGroup 是一个基于 Vue 3 + TypeScript + Vant 4 开发的表单组组件,支持多标签页表单展示,可以通过配置实现复杂的表单组合。组件支持两种模式:普通表单模式和插槽(slot)模式。
|
|
6
|
+
|
|
7
|
+
## 功能特性
|
|
8
|
+
|
|
9
|
+
- 🏷️ **多标签页支持**:使用 Vant Tabs 组件实现标签页切换
|
|
10
|
+
- 🔧 **插槽模式**:支持通过 slot 自定义表单内容
|
|
11
|
+
- 📝 **表单验证**:支持表单数据验证和提交
|
|
12
|
+
- 🎯 **动态配置**:通过配置文件动态生成表单结构
|
|
13
|
+
- 🔄 **数据绑定**:支持表单数据的双向绑定
|
|
14
|
+
- 📱 **移动端优化**:基于 Vant 4 组件库,专为移动端设计
|
|
15
|
+
|
|
16
|
+
## 基础用法
|
|
17
|
+
|
|
18
|
+
```vue
|
|
19
|
+
// 见 FormGroupDemo.vue
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Props 参数详解
|
|
23
|
+
|
|
24
|
+
### configName
|
|
25
|
+
- **类型**: `string`
|
|
26
|
+
- **默认值**: `''`
|
|
27
|
+
- **说明**: 表单配置名称,用于从后端获取表单配置信息
|
|
28
|
+
- **示例**: `'appapplyuserinfoFormGroup'`
|
|
29
|
+
|
|
30
|
+
### serviceName
|
|
31
|
+
- **类型**: `string | undefined`
|
|
32
|
+
- **默认值**: `undefined`
|
|
33
|
+
- **说明**: 服务名称,用于指定后端服务
|
|
34
|
+
- **示例**: `'af-apply'`
|
|
35
|
+
|
|
36
|
+
### groupFormData
|
|
37
|
+
- **类型**: `object`
|
|
38
|
+
- **默认值**: `() => ({})`
|
|
39
|
+
- **说明**: 表单组数据,用于初始化表单数据
|
|
40
|
+
- **示例**:
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
// -{
|
|
44
|
+
// - userInfo: { name: '张三', age: 25 },
|
|
45
|
+
// - deviceInfo: { deviceId: '001', status: 'active' }
|
|
46
|
+
// -}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### mode
|
|
50
|
+
- **类型**: `string`
|
|
51
|
+
- **默认值**: `'查询'`
|
|
52
|
+
- **说明**: `表单模式,控制表单的显示和操作模式`
|
|
53
|
+
- **可选值**: `'查询'` | `'新增'` | `'编辑'` | `'查看'`
|
|
54
|
+
|
|
55
|
+
## 插槽(Slot)使用详解
|
|
56
|
+
|
|
57
|
+
### 插槽模式配置
|
|
58
|
+
|
|
59
|
+
当配置中的 `formGroupType` 为 `'slot'` 时,组件会渲染插槽内容而不是默认的 XForm 组件。
|
|
60
|
+
|
|
61
|
+
#### 插槽参数
|
|
62
|
+
|
|
63
|
+
插槽会接收以下参数:
|
|
64
|
+
|
|
65
|
+
- **userItem/deviceItem**: 当前标签页的配置项
|
|
66
|
+
- **userFormData/deviceFormData**: 当前标签页对应的表单数据
|
|
67
|
+
- **setRef**: 注册表单实例的函数
|
|
68
|
+
- **removeRef**: 注销表单实例的函数
|
|
69
|
+
|
|
70
|
+
### 完整使用示例
|
|
71
|
+
|
|
72
|
+
#### 1. 主页面组件
|
|
73
|
+
|
|
74
|
+
> 见 [FormGroupDemo.vue](FormGroupDemo.vue)
|
|
75
|
+
|
|
76
|
+
#### 2. 用户信息表单组件
|
|
77
|
+
|
|
78
|
+
> 见 [UserForm.vue](UserForm.vue)
|
|
79
|
+
|
|
80
|
+
#### 3. 设备信息表单组件
|
|
81
|
+
|
|
82
|
+
> 见 [DeviceForm.vue](DeviceForm.vue)
|
|
83
|
+
|
|
84
|
+
#### 4. 配置结构示例
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"groups": [
|
|
89
|
+
{
|
|
90
|
+
"groupName": "userInfo",
|
|
91
|
+
"describe": "用户信息",
|
|
92
|
+
"tableName": "用户信息表",
|
|
93
|
+
"formGroupType": "slot",
|
|
94
|
+
"slotName": "user",
|
|
95
|
+
"showSubmitBtn": false
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"groupName": "deviceInfo",
|
|
99
|
+
"describe": "设备信息",
|
|
100
|
+
"tableName": "设备信息表",
|
|
101
|
+
"formGroupType": "slot",
|
|
102
|
+
"slotName": "device",
|
|
103
|
+
"showSubmitBtn": true
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"showSubmitBtn": true
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### 5. setRef 和 removeRef 工作原理
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
// XFormGroup 组件内部的实现逻辑
|
|
114
|
+
const xFormListRef = ref([])
|
|
115
|
+
|
|
116
|
+
function setRef(refValue) {
|
|
117
|
+
if (refValue && !xFormListRef.value.includes(refValue)) {
|
|
118
|
+
xFormListRef.value.push(refValue)
|
|
119
|
+
console.log('注册表单实例:', refValue.formGroupName)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function removeRef(refValue) {
|
|
124
|
+
const idx = xFormListRef.value.indexOf(refValue)
|
|
125
|
+
if (idx !== -1) {
|
|
126
|
+
xFormListRef.value.splice(idx, 1)
|
|
127
|
+
console.log('注销表单实例:', refValue.formGroupName)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async function submit() {
|
|
132
|
+
const allFormData = {}
|
|
133
|
+
for (const formInstance of xFormListRef.value) {
|
|
134
|
+
try {
|
|
135
|
+
await formInstance.validate()
|
|
136
|
+
if (formInstance.formGroupName && typeof formInstance.getFormData === 'function') {
|
|
137
|
+
allFormData[formInstance.formGroupName] = formInstance.getFormData()
|
|
138
|
+
}
|
|
139
|
+
} catch (error) {
|
|
140
|
+
console.error('表单验证失败:', error)
|
|
141
|
+
return
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
emit('submit', allFormData)
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 关键要点
|
|
149
|
+
|
|
150
|
+
1. **必须实现的方法**:
|
|
151
|
+
- `validate()`: 表单验证方法
|
|
152
|
+
- `getFormData()`: 获取表单数据方法
|
|
153
|
+
- `formGroupName`: 表单组名称
|
|
154
|
+
2. **生命周期管理**:
|
|
155
|
+
- 在 `onMounted` 时调用 `setRef` 注册
|
|
156
|
+
- 在 `onUnmounted` 时调用 `removeRef` 注销
|
|
157
|
+
3. **数据传递**:
|
|
158
|
+
- 通过 `defineExpose` 暴露方法给父组件
|
|
159
|
+
- 通过 `props` 接收父组件传递的参数
|
|
160
|
+
4. **插槽使用**:
|
|
161
|
+
- 插槽名称必须与配置中的 `slotName` 一致
|
|
162
|
+
- 必须传递 `setRef` 和 `removeRef` 给子组件
|
|
163
|
+
|
|
164
|
+
## 事件
|
|
165
|
+
|
|
166
|
+
### submit
|
|
167
|
+
- **参数**: `formData: object`
|
|
168
|
+
- **说明**: 表单提交事件,当用户点击提交按钮时触发
|
|
169
|
+
- **示例**:
|
|
170
|
+
```javascript
|
|
171
|
+
function handleSubmit(formData) {
|
|
172
|
+
console.log('表单数据:', formData)
|
|
173
|
+
// 处理表单提交逻辑
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## 方法
|
|
178
|
+
|
|
179
|
+
### init(params: Form)
|
|
180
|
+
- **参数**: `params` - 初始化参数对象
|
|
181
|
+
- **说明**: 手动初始化组件,可以动态改变配置
|
|
182
|
+
- **示例**:
|
|
183
|
+
```javascript
|
|
184
|
+
formGroup.value.init({
|
|
185
|
+
configName: 'newConfig',
|
|
186
|
+
serviceName: 'newService',
|
|
187
|
+
groupFormData: { ... },
|
|
188
|
+
mode: '新增'
|
|
189
|
+
})
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### setRef(refValue)
|
|
193
|
+
- **参数**: `refValue` - 表单实例
|
|
194
|
+
- **说明**: 注册表单实例到组件中,用于统一管理和提交
|
|
195
|
+
|
|
196
|
+
### removeRef(refValue)
|
|
197
|
+
- **参数**: `refValue` - 表单实例
|
|
198
|
+
- **说明**: 从组件中注销表单实例
|
|
199
|
+
|
|
200
|
+
## 配置结构说明
|
|
201
|
+
|
|
202
|
+
### 基础配置结构
|
|
203
|
+
```javascript
|
|
204
|
+
{
|
|
205
|
+
groups: [
|
|
206
|
+
{
|
|
207
|
+
"groupName": "userInfo",
|
|
208
|
+
"describe": "用户信息",
|
|
209
|
+
"tableName": "用户信息表",
|
|
210
|
+
"formGroupType": "form", // 或 "slot"
|
|
211
|
+
"slotName": "user", // 当 formGroupType 为 "slot" 时使用
|
|
212
|
+
"showSubmitBtn": false
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"groupName": "deviceInfo",
|
|
216
|
+
"describe": "设备信息",
|
|
217
|
+
"tableName": "设备信息表",
|
|
218
|
+
"formGroupType": "slot",
|
|
219
|
+
"slotName": "device",
|
|
220
|
+
"showSubmitBtn": true
|
|
221
|
+
}
|
|
222
|
+
],
|
|
223
|
+
showSubmitBtn: true
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### 配置项说明
|
|
228
|
+
|
|
229
|
+
| 字段名 | 类型 | 说明 |
|
|
230
|
+
|--------|------|------|
|
|
231
|
+
| groupName | string | 分组名称,用于数据分组 |
|
|
232
|
+
| describe | string | 标签页显示标题 |
|
|
233
|
+
| tableName | string | 表名,当 describe 为空时作为标题 |
|
|
234
|
+
| formGroupType | string | 表单类型,'form' 为普通表单,'slot' 为插槽 |
|
|
235
|
+
| slotName | string | 插槽名称,当 formGroupType 为 'slot' 时使用 |
|
|
236
|
+
| showSubmitBtn | boolean | 是否显示提交按钮 |
|
|
237
|
+
|
|
238
|
+
## 样式定制
|
|
239
|
+
|
|
240
|
+
组件使用 Less 预处理器,可以通过以下方式定制样式:
|
|
241
|
+
|
|
242
|
+
```less
|
|
243
|
+
#x-form-group {
|
|
244
|
+
background-color: #f7f8fa;
|
|
245
|
+
padding-bottom: 10px;
|
|
246
|
+
|
|
247
|
+
.x-form-group-item {
|
|
248
|
+
margin: 20px 0;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// 自定义标签页样式
|
|
252
|
+
:deep(.van-tabs__nav) {
|
|
253
|
+
background-color: #fff;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// 自定义按钮样式
|
|
257
|
+
:deep(.van-button--primary) {
|
|
258
|
+
background-color: #1989fa;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## 注意事项
|
|
264
|
+
|
|
265
|
+
1. **插槽注册**: 使用插槽模式时,子组件必须通过 `setRef` 和 `removeRef` 注册到父组件
|
|
266
|
+
2. **数据同步**: 插槽组件需要实现 `getFormData` 方法返回表单数据
|
|
267
|
+
3. **表单验证**: 插槽组件可以实现 `validate` 方法进行表单验证
|
|
268
|
+
4. **生命周期**: 插槽组件需要在 `onMounted` 时注册,`onUnmounted` 时注销
|
|
269
|
+
5. **配置加载**: 组件会在 `onBeforeMount` 时自动加载配置,也可以通过 `init` 方法手动初始化
|
|
270
|
+
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## 这个文档详细介绍了 XFormGroup 组件的使用方法,特别是插槽的使用方式和各个参数的详细说明。开发者可以根据这个文档快速上手使用该组件。
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { CellGroup as VanCellGroup, Field as VanField } from 'vant'
|
|
3
|
+
import { defineExpose, defineProps, onMounted, onUnmounted, ref } from 'vue'
|
|
4
|
+
|
|
5
|
+
interface UserFormProps {
|
|
6
|
+
setRef?: (refValue: any) => void
|
|
7
|
+
removeRef?: (refValue: any) => void
|
|
8
|
+
formGroupName?: string
|
|
9
|
+
formData?: any
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const props = withDefaults(defineProps<UserFormProps>(), {
|
|
13
|
+
setRef: () => {},
|
|
14
|
+
removeRef: () => {},
|
|
15
|
+
formGroupName: 'userInfo',
|
|
16
|
+
formData: () => ({}),
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const formData = ref({
|
|
20
|
+
name: '',
|
|
21
|
+
phone: '',
|
|
22
|
+
email: '',
|
|
23
|
+
...props.formData,
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
async function validate() {
|
|
27
|
+
if (!formData.value.name) {
|
|
28
|
+
throw new Error('姓名不能为空')
|
|
29
|
+
}
|
|
30
|
+
if (!formData.value.phone) {
|
|
31
|
+
throw new Error('手机号不能为空')
|
|
32
|
+
}
|
|
33
|
+
const phoneRegex = /^1[3-9]\d{9}$/
|
|
34
|
+
if (!phoneRegex.test(formData.value.phone)) {
|
|
35
|
+
throw new Error('手机号格式不正确')
|
|
36
|
+
}
|
|
37
|
+
return Promise.resolve()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function getFormData() {
|
|
41
|
+
return {
|
|
42
|
+
name: formData.value.name,
|
|
43
|
+
phone: formData.value.phone,
|
|
44
|
+
email: formData.value.email,
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function resetForm() {
|
|
49
|
+
formData.value = {
|
|
50
|
+
name: '',
|
|
51
|
+
phone: '',
|
|
52
|
+
email: '',
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const exposeObj = {
|
|
57
|
+
validate,
|
|
58
|
+
getFormData,
|
|
59
|
+
resetForm,
|
|
60
|
+
formGroupName: props.formGroupName,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
defineExpose(exposeObj)
|
|
64
|
+
|
|
65
|
+
onMounted(() => {
|
|
66
|
+
props.setRef(exposeObj)
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
onUnmounted(() => {
|
|
70
|
+
props.removeRef(exposeObj)
|
|
71
|
+
})
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<template>
|
|
75
|
+
<div class="user-form">
|
|
76
|
+
<VanCellGroup inset>
|
|
77
|
+
<VanField
|
|
78
|
+
v-model="formData.name"
|
|
79
|
+
label="姓名"
|
|
80
|
+
placeholder="请输入姓名"
|
|
81
|
+
:rules="[{ required: true, message: '请输入姓名' }]"
|
|
82
|
+
/>
|
|
83
|
+
<VanField
|
|
84
|
+
v-model="formData.phone"
|
|
85
|
+
label="手机号"
|
|
86
|
+
placeholder="请输入手机号"
|
|
87
|
+
:rules="[{ required: true, message: '请输入手机号' }]"
|
|
88
|
+
/>
|
|
89
|
+
<VanField
|
|
90
|
+
v-model="formData.email"
|
|
91
|
+
label="邮箱"
|
|
92
|
+
placeholder="请输入邮箱"
|
|
93
|
+
/>
|
|
94
|
+
</VanCellGroup>
|
|
95
|
+
</div>
|
|
96
|
+
</template>
|
|
97
|
+
|
|
98
|
+
<style scoped lang="less">
|
|
99
|
+
.user-form {
|
|
100
|
+
padding: 16px;
|
|
101
|
+
}
|
|
102
|
+
</style>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
|
|
3
3
|
import { getConfigByName } from '@af-mobile-client-vue3/services/api/common'
|
|
4
4
|
import { Button as VanButton, Tab as VanTab, Tabs as VanTabs } from 'vant'
|
|
5
|
-
import { defineEmits, defineProps, onBeforeMount, onMounted, ref, watch } from 'vue'
|
|
5
|
+
import { computed, defineEmits, defineProps, onBeforeMount, onMounted, ref, useSlots, watch } from 'vue'
|
|
6
6
|
|
|
7
7
|
const props = withDefaults(defineProps<{
|
|
8
8
|
configName?: string
|
|
@@ -33,7 +33,17 @@ const submitGroup = ref(false)
|
|
|
33
33
|
const submitSimple = ref(false)
|
|
34
34
|
const isInit = ref(false)
|
|
35
35
|
const initStatus = ref(false)
|
|
36
|
-
const propsData = ref<Form
|
|
36
|
+
const propsData = ref<Partial<Form>>({})
|
|
37
|
+
|
|
38
|
+
const slots = useSlots()
|
|
39
|
+
const renderableGroupItems = computed(() => {
|
|
40
|
+
return groupItems.value.filter((item) => {
|
|
41
|
+
if (item.formGroupType === 'slot') {
|
|
42
|
+
return !!(item.slotName && slots[item.slotName])
|
|
43
|
+
}
|
|
44
|
+
return true
|
|
45
|
+
})
|
|
46
|
+
})
|
|
37
47
|
|
|
38
48
|
// 组件初始化函数
|
|
39
49
|
function init(params: Form) {
|
|
@@ -50,7 +60,7 @@ function init(params: Form) {
|
|
|
50
60
|
if (result?.groups) {
|
|
51
61
|
groupItems.value = result.groups
|
|
52
62
|
result.groups.forEach((group) => {
|
|
53
|
-
if (!formData.value[group.groupName])
|
|
63
|
+
if (!formData.value[group.groupName] && group.formGroupType !== 'slot')
|
|
54
64
|
formData.value[group.groupName] = {}
|
|
55
65
|
if (group.showSubmitBtn)
|
|
56
66
|
submitGroup.value = true
|
|
@@ -70,11 +80,39 @@ onBeforeMount(() => {
|
|
|
70
80
|
if (!initStatus.value)
|
|
71
81
|
init(props)
|
|
72
82
|
})
|
|
73
|
-
|
|
83
|
+
interface XFormLike {
|
|
84
|
+
validate: () => Promise<void>
|
|
85
|
+
formGroupName?: string
|
|
86
|
+
form?: any
|
|
87
|
+
getFormData?: () => object
|
|
88
|
+
}
|
|
89
|
+
const xFormListRef = ref<XFormLike[]>([])
|
|
90
|
+
|
|
91
|
+
// 注册表单实例,避免重复
|
|
92
|
+
function setRef(refValue: XFormLike) {
|
|
93
|
+
if (refValue && !xFormListRef.value.includes(refValue)) {
|
|
94
|
+
xFormListRef.value.push(refValue)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// 注销表单实例
|
|
98
|
+
function removeRef(refValue: XFormLike) {
|
|
99
|
+
const idx = xFormListRef.value.indexOf(refValue)
|
|
100
|
+
if (idx !== -1)
|
|
101
|
+
xFormListRef.value.splice(idx, 1)
|
|
102
|
+
}
|
|
103
|
+
|
|
74
104
|
async function submit() {
|
|
75
105
|
for (const res of xFormListRef.value) {
|
|
76
|
-
|
|
77
|
-
|
|
106
|
+
try {
|
|
107
|
+
await res.validate()
|
|
108
|
+
if (res.formGroupName && typeof res.getFormData === 'function') {
|
|
109
|
+
formData.value[res.formGroupName] = res.getFormData()
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch (msg) {
|
|
113
|
+
console.log('error:', msg)
|
|
114
|
+
return
|
|
115
|
+
}
|
|
78
116
|
}
|
|
79
117
|
emit('submit', formData.value)
|
|
80
118
|
}
|
|
@@ -87,14 +125,14 @@ onMounted(() => {
|
|
|
87
125
|
offsetTop.value = Number.parseInt(navBarHeight, 10) || 60 + 10
|
|
88
126
|
})
|
|
89
127
|
|
|
90
|
-
defineExpose({ init })
|
|
128
|
+
defineExpose({ init, removeRef, xFormListRef })
|
|
91
129
|
</script>
|
|
92
130
|
|
|
93
131
|
<template>
|
|
94
132
|
<div v-if="isInit" id="x-form-group">
|
|
95
133
|
<VanTabs :scrollspy="propsData.isScrollspy" sticky :offset-top="offsetTop">
|
|
96
134
|
<VanTab
|
|
97
|
-
v-for="(item, index) in
|
|
135
|
+
v-for="(item, index) in renderableGroupItems"
|
|
98
136
|
:key="item.groupName ? (item.groupName + index) : index"
|
|
99
137
|
:title="item.describe ? item.describe : item.tableName "
|
|
100
138
|
>
|
|
@@ -106,17 +144,28 @@ defineExpose({ init })
|
|
|
106
144
|
<span class="form-group-bar" />
|
|
107
145
|
<span class="form-group-text">{{ item.describe }}</span>
|
|
108
146
|
</div>
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
147
|
+
<template v-if="item.formGroupType === 'slot'">
|
|
148
|
+
<slot
|
|
149
|
+
:name="item.slotName"
|
|
150
|
+
:item="item"
|
|
151
|
+
:form-data="item.groupName ? formData[item.groupName] : formData"
|
|
152
|
+
:set-ref="setRef"
|
|
153
|
+
:remove-ref="removeRef"
|
|
154
|
+
/>
|
|
155
|
+
</template>
|
|
156
|
+
<template v-else>
|
|
157
|
+
<XForm
|
|
158
|
+
ref="xFormListRef"
|
|
159
|
+
:mode="props.mode"
|
|
160
|
+
:is-group-form="true"
|
|
161
|
+
:group-form-items="item"
|
|
162
|
+
:form-data="item.groupName ? formData[item.groupName] : formData"
|
|
163
|
+
:form-name="item.groupName"
|
|
164
|
+
:service-name="props.serviceName"
|
|
165
|
+
:submit-button="submitSimple"
|
|
166
|
+
@on-submit="submit"
|
|
167
|
+
/>
|
|
168
|
+
</template>
|
|
120
169
|
</div>
|
|
121
170
|
</VanTab>
|
|
122
171
|
</VanTabs>
|
|
@@ -366,6 +366,8 @@ function updateFile(files, _index) {
|
|
|
366
366
|
function formTypeCheck(attr, value) {
|
|
367
367
|
if (this.mode === '查询')
|
|
368
368
|
return
|
|
369
|
+
if (!attr.rule || !attr.rule.required || attr.rule.required === 'false')
|
|
370
|
+
return
|
|
369
371
|
switch (attr.rule.type) {
|
|
370
372
|
case 'string':
|
|
371
373
|
if (value.length === 0) {
|
|
@@ -783,6 +785,7 @@ function emitFunc(func, data) {
|
|
|
783
785
|
:label-align="labelAlign"
|
|
784
786
|
:input-align="attr.inputAlign ? attr.inputAlign : 'right'"
|
|
785
787
|
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
788
|
+
:required="attr.rule.required === 'true'"
|
|
786
789
|
>
|
|
787
790
|
<template #input>
|
|
788
791
|
<VanSwitch v-model="modelData" />
|
|
@@ -810,6 +813,7 @@ function emitFunc(func, data) {
|
|
|
810
813
|
:label-align="labelAlign"
|
|
811
814
|
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
812
815
|
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
816
|
+
:required="attr.rule.required === 'true'"
|
|
813
817
|
>
|
|
814
818
|
<template #input>
|
|
815
819
|
<van-checkbox-group v-model="modelData as any[]" direction="horizontal" shape="square" :disabled="readonly">
|
|
@@ -846,6 +850,7 @@ function emitFunc(func, data) {
|
|
|
846
850
|
:columns="option"
|
|
847
851
|
:option="attr.option ? attr.option : columnsField"
|
|
848
852
|
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
853
|
+
:required="attr.rule.required === 'true'"
|
|
849
854
|
/>
|
|
850
855
|
</template>
|
|
851
856
|
|
|
@@ -858,6 +863,7 @@ function emitFunc(func, data) {
|
|
|
858
863
|
:label-align="labelAlign"
|
|
859
864
|
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
860
865
|
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
866
|
+
:required="attr.rule.required === 'true'"
|
|
861
867
|
>
|
|
862
868
|
<template #input>
|
|
863
869
|
<VanRadioGroup v-model="modelData" direction="horizontal" :disabled="readonly">
|
|
@@ -895,6 +901,7 @@ function emitFunc(func, data) {
|
|
|
895
901
|
:label-align="labelAlign"
|
|
896
902
|
:input-align="attr.inputAlign ? attr.inputAlign : 'center'"
|
|
897
903
|
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
904
|
+
:required="attr.rule.required === 'true'"
|
|
898
905
|
>
|
|
899
906
|
<template #input>
|
|
900
907
|
<VanStepper v-model="modelData as any" :disabled="readonly" />
|
|
@@ -909,6 +916,7 @@ function emitFunc(func, data) {
|
|
|
909
916
|
:label-align="labelAlign"
|
|
910
917
|
:input-align="attr.inputAlign ? attr.inputAlign : 'center'"
|
|
911
918
|
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
919
|
+
:required="attr.rule.required === 'true'"
|
|
912
920
|
>
|
|
913
921
|
<template #input>
|
|
914
922
|
<VanRate v-model="modelData as number" :size="25" :readonly="readonly" void-color="#eee" void-icon="star" color="#ffd21e" />
|
|
@@ -923,6 +931,7 @@ function emitFunc(func, data) {
|
|
|
923
931
|
:label-align="labelAlign"
|
|
924
932
|
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
925
933
|
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
934
|
+
:required="attr.rule.required === 'true'"
|
|
926
935
|
>
|
|
927
936
|
<template #input>
|
|
928
937
|
<VanSlider v-model="modelData as number" :readonly="readonly" />
|
|
@@ -937,6 +946,7 @@ function emitFunc(func, data) {
|
|
|
937
946
|
:label-align="labelAlign"
|
|
938
947
|
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
939
948
|
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
949
|
+
:required="attr.rule.required === 'true'"
|
|
940
950
|
>
|
|
941
951
|
<template #input>
|
|
942
952
|
<!-- <van-uploader v-model="localValue" /> -->
|
|
@@ -957,6 +967,7 @@ function emitFunc(func, data) {
|
|
|
957
967
|
:label-align="labelAlign"
|
|
958
968
|
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
959
969
|
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
970
|
+
:required="attr.rule.required === 'true'"
|
|
960
971
|
>
|
|
961
972
|
<template #input>
|
|
962
973
|
<ImageUploader
|
|
@@ -1033,6 +1044,7 @@ function emitFunc(func, data) {
|
|
|
1033
1044
|
:is-link="true"
|
|
1034
1045
|
:placeholder="placeholder"
|
|
1035
1046
|
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1047
|
+
:required="attr.rule.required === 'true'"
|
|
1036
1048
|
@click="readonly ? null : showDataTimePicker()"
|
|
1037
1049
|
/>
|
|
1038
1050
|
<VanPopup v-model:show="showDatePicker" position="bottom" teleport="body" overlay-class="date-picker-overlay">
|
|
@@ -1134,6 +1146,7 @@ function emitFunc(func, data) {
|
|
|
1134
1146
|
:label-align="labelAlign"
|
|
1135
1147
|
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1136
1148
|
:rules="[{ required: attr.rule.required === 'true', message: '请选择' }]"
|
|
1149
|
+
:required="attr.rule.required === 'true'"
|
|
1137
1150
|
@click="readonly ? null : showArea = true"
|
|
1138
1151
|
/>
|
|
1139
1152
|
<VanPopup v-model:show="showArea" position="bottom" teleport="body" overlay-class="date-picker-overlay">
|
|
@@ -1155,6 +1168,7 @@ function emitFunc(func, data) {
|
|
|
1155
1168
|
:columns="option"
|
|
1156
1169
|
:option="attr.option ? attr.option : columnsField"
|
|
1157
1170
|
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1171
|
+
:required="attr.rule.required === 'true'"
|
|
1158
1172
|
/>
|
|
1159
1173
|
|
|
1160
1174
|
<!-- 文本区域 -->
|
|
@@ -1172,6 +1186,7 @@ function emitFunc(func, data) {
|
|
|
1172
1186
|
:placeholder="attr.placeholder ? attr.placeholder : `请输入${attr.name}`"
|
|
1173
1187
|
show-word-limit
|
|
1174
1188
|
:rules="[{ required: attr.rule.required === 'true', message: `请填写${attr.name}` }]"
|
|
1189
|
+
:required="attr.rule.required === 'true'"
|
|
1175
1190
|
/>
|
|
1176
1191
|
|
|
1177
1192
|
<!-- 文本输入框 -->
|
|
@@ -1188,6 +1203,7 @@ function emitFunc(func, data) {
|
|
|
1188
1203
|
:error-message="errorMessage"
|
|
1189
1204
|
:clearable="attr.clearable"
|
|
1190
1205
|
:rules="[{ required: attr.rule.required === 'true', message: `请填写${attr.name}` }]"
|
|
1206
|
+
:required="attr.rule.required === 'true'"
|
|
1191
1207
|
@blur="() => formTypeCheck(attr, modelData as string)"
|
|
1192
1208
|
>
|
|
1193
1209
|
<template #input>
|
|
@@ -1225,6 +1241,7 @@ function emitFunc(func, data) {
|
|
|
1225
1241
|
is-link
|
|
1226
1242
|
:placeholder="placeholder"
|
|
1227
1243
|
:rules="[{ required: attr.rule.required === 'true', message: '请选择地址' }]"
|
|
1244
|
+
:required="attr.rule.required === 'true'"
|
|
1228
1245
|
@click="readonly ? null : showAddressPicker = true"
|
|
1229
1246
|
/>
|
|
1230
1247
|
<VanPopup
|
|
@@ -1253,6 +1270,7 @@ function emitFunc(func, data) {
|
|
|
1253
1270
|
is-link
|
|
1254
1271
|
:placeholder="attr.placeholder ? attr.placeholder : `请选择${attr.name}`"
|
|
1255
1272
|
:rules="[{ required: attr.rule.required === 'true', message: `请选择${attr.name}` }]"
|
|
1273
|
+
:required="attr.rule.required === 'true'"
|
|
1256
1274
|
@click="readonly ? null : showTreeSelect = true"
|
|
1257
1275
|
/>
|
|
1258
1276
|
<VanPopup
|
|
@@ -96,13 +96,13 @@ function addOption() {
|
|
|
96
96
|
function updateRow(result) {
|
|
97
97
|
console.log('用户----', userInfo)
|
|
98
98
|
router.push({
|
|
99
|
-
name: '
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
name: 'XFormView',
|
|
100
|
+
params: { id: 1, openid: 2 },
|
|
101
|
+
query: {
|
|
102
|
+
configName: configName.value,
|
|
103
|
+
serviceName: serviceName.value,
|
|
104
|
+
mode: '修改',
|
|
105
|
+
},
|
|
106
106
|
})
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -136,10 +136,17 @@ function deleteRow(result) {
|
|
|
136
136
|
<!-- @delete-row="deleteRow" -->
|
|
137
137
|
<!-- /> -->
|
|
138
138
|
|
|
139
|
+
<!-- <XCellList -->
|
|
140
|
+
<!-- service-name="af-revenue" -->
|
|
141
|
+
<!-- config-name="userfiles_sel_address" -->
|
|
142
|
+
<!-- @to-detail="toDetail" -->
|
|
143
|
+
<!-- /> -->
|
|
139
144
|
<XCellList
|
|
140
|
-
service-name="af-
|
|
141
|
-
config-name="
|
|
145
|
+
service-name="af-apply"
|
|
146
|
+
config-name="ApplyContractPhoneCRUD"
|
|
147
|
+
:custom-add="true"
|
|
142
148
|
@to-detail="toDetail"
|
|
149
|
+
@add="updateRow"
|
|
143
150
|
/>
|
|
144
151
|
</template>
|
|
145
152
|
</NormalDataLayout>
|
|
@@ -3,8 +3,8 @@ import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
|
|
|
3
3
|
import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
|
|
4
4
|
import { ref } from 'vue'
|
|
5
5
|
|
|
6
|
-
const configName = ref('
|
|
7
|
-
const serviceName = ref('af-
|
|
6
|
+
const configName = ref('addappapplychargeForm')
|
|
7
|
+
const serviceName = ref('af-apply')
|
|
8
8
|
|
|
9
9
|
const formGroupAddConstruction = ref(null)
|
|
10
10
|
</script>
|