@bsgoal/common 2.7.9 → 2.8.0
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 14:
|
|
5
|
+
* @LastEditTime: 2023-05-30 14:45:55
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-form\demo.vue
|
|
7
7
|
* @Description: 表单公共组件演示组件
|
|
8
8
|
*
|
|
@@ -47,8 +47,10 @@ const configOptions = ref([
|
|
|
47
47
|
{
|
|
48
48
|
validator: (rule, value, callback) => {
|
|
49
49
|
console.log('value', value)
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
// return callback(new Error('Please input the age'))
|
|
53
|
+
return callback()
|
|
52
54
|
},
|
|
53
55
|
trigger: 'change'
|
|
54
56
|
}
|
|
@@ -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 14:
|
|
5
|
+
* @LastEditTime: 2023-05-30 14:52:13
|
|
6
6
|
* @FilePath: \common\src\components\bsgoal-base-form\index.vue
|
|
7
7
|
* @Description: 表单公共组件
|
|
8
8
|
*
|
|
@@ -153,8 +153,11 @@ watchEffect(() => {
|
|
|
153
153
|
watchPropList.push(prop)
|
|
154
154
|
}
|
|
155
155
|
const bindValue = unref(model)[prop]
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
if (prop.startsWith('_')) {
|
|
157
|
+
model.value[prop] = `${prop}`
|
|
158
|
+
} else {
|
|
159
|
+
model.value[prop] = bindValue || valuesModel[prop] || value
|
|
160
|
+
}
|
|
158
161
|
|
|
159
162
|
if (isObject(show)) {
|
|
160
163
|
watchPropsForShow(show, unref(model), prop)
|
|
@@ -175,13 +178,13 @@ const configOptionsGet = computed(() => {
|
|
|
175
178
|
const { configOptions } = props
|
|
176
179
|
const options = unref(configOptions)
|
|
177
180
|
const reOptions = options.map((option) => {
|
|
178
|
-
let { rules = [], label = '',
|
|
181
|
+
let { rules = [], label = '', prop = '' } = option
|
|
179
182
|
const requiredRule = { required: true, message: `${label}不能为空`, trigger: 'blur' }
|
|
180
183
|
if (isBoolean(rules) && rules) {
|
|
181
184
|
rules = [requiredRule]
|
|
182
|
-
} else if (
|
|
183
|
-
rules = [
|
|
184
|
-
}
|
|
185
|
+
} else if (Array.isArray(rules) && !!rules.length) {
|
|
186
|
+
rules = [requiredRule, ...rules]
|
|
187
|
+
}
|
|
185
188
|
option.rules = rules
|
|
186
189
|
return option
|
|
187
190
|
})
|
|
@@ -434,7 +437,7 @@ defineExpose({
|
|
|
434
437
|
:key="key"
|
|
435
438
|
>
|
|
436
439
|
<el-col :class="{ 'base_form--visible': !visible }" :xs="24" :sm="24" :md="medium">
|
|
437
|
-
<el-form-item :label="label" :prop="prop" :rules="rules"
|
|
440
|
+
<el-form-item :label="label" :prop="prop" :rules="rules">
|
|
438
441
|
<slot :name="[prop]" :option="{ readonly, value: model[prop], values: model }">
|
|
439
442
|
<!-- S 内容组件 -->
|
|
440
443
|
<template v-if="!readonly">
|