@bsgoal/common 2.7.6 → 2.7.8
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
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: canlong.shen
|
|
3
3
|
* @Date: 2023-04-10 15:00:00
|
|
4
4
|
* @LastEditors: canlong.shen
|
|
5
|
-
* @LastEditTime: 2023-05-30
|
|
5
|
+
* @LastEditTime: 2023-05-30 14:07:00
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-form\demo.vue
|
|
7
7
|
* @Description: 表单公共组件演示组件
|
|
8
8
|
*
|
|
@@ -33,14 +33,26 @@ const confirm = () => {
|
|
|
33
33
|
})
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
const bindModel = ref({ prop1: '111', prop99: 1, prop101: '否', prop102: '0'
|
|
36
|
+
const bindModel = ref({ prop1: '111', prop99: 1, prop101: '否', prop102: '0', _prop104: '' })
|
|
37
|
+
|
|
38
|
+
|
|
37
39
|
|
|
38
40
|
// 配置项
|
|
39
41
|
const configOptions = ref([
|
|
40
|
-
|
|
42
|
+
{
|
|
41
43
|
label: 'prop104',
|
|
42
44
|
prop: '_prop104',
|
|
43
|
-
|
|
45
|
+
validator:true,
|
|
46
|
+
rules: [
|
|
47
|
+
{
|
|
48
|
+
validator: (rule, value, callback) => {
|
|
49
|
+
console.log('value', value)
|
|
50
|
+
|
|
51
|
+
return callback(new Error('Please input the age'))
|
|
52
|
+
},
|
|
53
|
+
trigger: 'change'
|
|
54
|
+
}
|
|
55
|
+
]
|
|
44
56
|
},
|
|
45
57
|
{
|
|
46
58
|
label: 'prop103',
|
|
@@ -249,9 +261,9 @@ const configOptions = ref([
|
|
|
249
261
|
:config-options="configOptions"
|
|
250
262
|
:bind-model="bindModel"
|
|
251
263
|
>
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
264
|
+
<template #_prop104>
|
|
265
|
+
6666
|
|
266
|
+
</template>
|
|
255
267
|
</BsgoalBaseForm>
|
|
256
268
|
<el-button type="primary" @click="confirm">提交</el-button>
|
|
257
269
|
</div>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: canlong.shen
|
|
3
3
|
* @Date: 2023-04-17 11:44:29
|
|
4
4
|
* @LastEditors: canlong.shen
|
|
5
|
-
* @LastEditTime: 2023-05-30
|
|
5
|
+
* @LastEditTime: 2023-05-30 14:05:39
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-form\index.vue
|
|
7
7
|
* @Description: 表单公共组件
|
|
8
8
|
*
|
|
@@ -175,15 +175,13 @@ const configOptionsGet = computed(() => {
|
|
|
175
175
|
const { configOptions } = props
|
|
176
176
|
const options = unref(configOptions)
|
|
177
177
|
const reOptions = options.map((option) => {
|
|
178
|
-
let { rules = [], label = '' } = option
|
|
178
|
+
let { rules = [], label = '', validator = false } = option
|
|
179
179
|
const requiredRule = { required: true, message: `${label}不能为空`, trigger: 'blur' }
|
|
180
180
|
if (isBoolean(rules) && rules) {
|
|
181
181
|
rules = [requiredRule]
|
|
182
|
-
} else if (Array.isArray(rules) && !!rules.length) {
|
|
183
|
-
rules = [requiredRule
|
|
184
|
-
}
|
|
185
|
-
rules = []
|
|
186
|
-
}
|
|
182
|
+
} else if ( !validator && Array.isArray(rules) && !!rules.length ) {
|
|
183
|
+
rules = [ requiredRule ,...rules,]
|
|
184
|
+
}
|
|
187
185
|
option.rules = rules
|
|
188
186
|
return option
|
|
189
187
|
})
|