Skip to content

Commit 5b4f16c

Browse files
committed
fix(vue3-antd): 修复form label 双冒号问题
修复双冒号,优化playground体验,调整默认form构造函数name名称 fix #46
1 parent 826b2e6 commit 5b4f16c

File tree

25 files changed

+95
-42
lines changed

25 files changed

+95
-42
lines changed

packages/demo/demo-common/components/EditorHeader.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,10 @@ export default {
100100
font-size: 26px;
101101
text-transform: uppercase;
102102
z-index: 10;
103+
margin: 0;
103104
}
104105
.logo {
105-
vertical-align: top;
106+
display: block;
106107
height: 30px;
107108
}
108109
}

packages/demo/demo-v3/src/pages/index/views/Demo/index.vue

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,35 @@
66
:show-version="true"
77
>
88
<div :class="$style.btns">
9-
<span style="font-size: 13px;">标签:</span>
10-
<el-slider
11-
v-model="formProps.labelWidth"
12-
style="width: 70px; margin-right: 6px;"
13-
size="mini"
14-
:format-tooltip="sliderFormat"
15-
></el-slider>
9+
<template v-if="isUseLabelWidth">
10+
<span style="font-size: 13px;">标签:</span>
11+
<el-slider
12+
v-model="formProps.labelWidth"
13+
style="width: 70px; margin-right: 6px;"
14+
size="mini"
15+
:format-tooltip="sliderFormat"
16+
></el-slider>
17+
</template>
18+
19+
<template v-else>
20+
<span style="font-size: 13px;">labelCol:</span>
21+
<el-slider
22+
v-model="formProps.labelColSpan"
23+
:min="5"
24+
:max="15"
25+
style="width: 70px; margin-right: 6px;"
26+
size="mini"
27+
></el-slider>
28+
<span style="font-size: 13px;">wrapperCol:</span>
29+
<el-slider
30+
v-model="formProps.wrapperColSpan"
31+
:min="5"
32+
:max="15"
33+
style="width: 70px; margin-right: 6px;"
34+
size="mini"
35+
></el-slider>
36+
</template>
37+
1638
<el-checkbox
1739
v-model="formProps.inline"
1840
style="margin-right: 6px;"
@@ -260,11 +282,29 @@ export default {
260282
pageKey() {
261283
return this.$route.query.type;
262284
},
285+
isUseLabelWidth() {
286+
return this.curVueForm === 'VueElementForm';
287+
},
263288
trueFormProps() {
264289
if (!this.formProps) return {};
290+
const {
291+
labelColSpan,
292+
wrapperColSpan,
293+
labelWidth,
294+
...otherProps
295+
} = this.formProps;
265296
return {
266-
...this.formProps,
267-
labelWidth: this.formProps.labelWidth ? `${this.formProps.labelWidth * 4}px` : undefined
297+
...otherProps,
298+
...this.isUseLabelWidth ? {
299+
labelWidth: labelWidth ? `${labelWidth * 4}px` : undefined
300+
} : {
301+
labelCol: {
302+
span: labelColSpan
303+
},
304+
wrapperCol: {
305+
span: wrapperColSpan
306+
}
307+
}
268308
};
269309
},
270310
trueFormFooter() {
@@ -351,6 +391,8 @@ export default {
351391
inline: false,
352392
labelPosition: 'top',
353393
inlineFooter: false,
394+
labelColSpan: 10,
395+
wrapperColSpan: 12,
354396
layoutColumn: 1
355397
}
356398
};

packages/docs/docs/zh/guide/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,15 @@ Field props配置,如果需要使用 `ui:field` 自定义field 组件,需要
200200
> 不使用 `ui-schema` `ui:field` 一般不会使用
201201
202202
#### vueUtils
203-
提供一些内部Vue相关的utils方法,详细的可以 [参见源码](https://github.com/lljj-x/vue-json-schema-form/blob/master/packages/lib/src/JsonSchemaForm/common/vueUtils.js)
203+
提供一些内部Vue相关的utils方法,详细的可以 [参见源码](https://github.com/lljj-x/vue-json-schema-form/blob/master/packages/lib/utils/vueUtils.js)
204204
> 不使用 `ui-schema` `ui:field` 一般不会使用
205205
206206
#### formUtils
207-
提供一些内部Form相关的utils方法,详细的可以 [参见源码](https://github.com/lljj-x/vue-json-schema-form/blob/master/packages/lib/src/JsonSchemaForm/common/formUtils.js)
207+
提供一些内部Form相关的utils方法,详细的可以 [参见源码](https://github.com/lljj-x/vue-json-schema-form/blob/master/packages/lib/utils/formUtils.js)
208208
> 不使用 `ui-schema` `ui:field` 一般不会使用
209209
210210
#### schemaValidate
211-
提供一些内部校验schema相关的方法,详细的可以 [参见源码](https://github.com/lljj-x/vue-json-schema-form/blob/master/packages/lib/src/JsonSchemaForm/common/schema/validate.js)
211+
提供一些内部校验schema相关的方法,详细的可以 [参见源码](https://github.com/lljj-x/vue-json-schema-form/blob/master/packages/lib/utils/schema/validate.js)
212212
> 不使用 `ui-schema` `ui:field` 一般不会使用
213213
214214
## 说明

packages/docs/docs/zh/guide/components.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* [DatePickerWidget](#datepickerwidget)
1313
* [DateTimePickerWidget](#datetimepickerwidget)
1414
* [UploadWidget](#uploadwidget)
15-
* [vue3 ant 特有的](#vue3-ant-特有的)
15+
* [vue3 ant 特有的](#vue3-ant-特有的全局组件)
1616

1717

1818
:::tip
@@ -162,4 +162,6 @@ vue3 ant 由于v-model不使用 `model: modelValue`,所以对常用的组件
162162
| AutoCompleteWidget | a-auto-complete |
163163
| SliderWidget | a-slider |
164164
| SwitchWidget | a-switch |
165+
| RateWidget | a-rate |
166+
165167

packages/lib/vue2/vue2-core/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function createForm(globalOptions = {}) {
3232
}
3333

3434
return {
35-
name: 'ElementForm',
35+
name: 'VueForm',
3636
props: vueProps,
3737
data() {
3838
const formData = getDefaultFormState(this.$props.schema, this.$props.value, this.$props.schema);

packages/lib/vue2/vue2-form-element/dist/vueJsonSchemaForm.esm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11522,7 +11522,7 @@ function createForm() {
1152211522
}
1152311523

1152411524
return {
11525-
name: 'ElementForm',
11525+
name: 'VueForm',
1152611526
props: vueProps,
1152711527
data: function data() {
1152811528
var formData = getDefaultFormState(this.$props.schema, this.$props.value, this.$props.schema); // 保持v-model双向数据及时性

packages/lib/vue2/vue2-form-element/dist/vueJsonSchemaForm.esm.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/lib/vue2/vue2-form-element/dist/vueJsonSchemaForm.umd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11530,7 +11530,7 @@
1153011530
}
1153111531

1153211532
return {
11533-
name: 'ElementForm',
11533+
name: 'VueForm',
1153411534
props: vueProps,
1153511535
data: function data() {
1153611536
var formData = getDefaultFormState(this.$props.schema, this.$props.value, this.$props.schema); // 保持v-model双向数据及时性

packages/lib/vue2/vue2-form-element/dist/vueJsonSchemaForm.umd.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/lib/vue2/vue2-form-iview3/dist/vue2-form-iview3.esm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11522,7 +11522,7 @@ function createForm() {
1152211522
}
1152311523

1152411524
return {
11525-
name: 'ElementForm',
11525+
name: 'VueForm',
1152611526
props: vueProps,
1152711527
data: function data() {
1152811528
var formData = getDefaultFormState(this.$props.schema, this.$props.value, this.$props.schema); // 保持v-model双向数据及时性

0 commit comments

Comments
 (0)