Skip to content

Commit cd3349e

Browse files
committedNov 25, 2020
fix(schema generator): 多选类型强制 uniqueItems
1 parent ff0d2da commit cd3349e

File tree

5 files changed

+22
-4
lines changed

5 files changed

+22
-4
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"packages:list": "lerna ls -l",
2323
"packages:changed": "lerna changed",
2424
"packages:build": "lerna run --stream --sort build",
25-
"publish": "yarn run lib:build && lerna publish",
25+
"publish1": "yarn run lib:build && lerna publish",
2626
"autoPublish": "lerna publish --conventional-commits --yes",
2727
"autoVersion": "lerna version --conventional-commits --yes"
2828
},

‎packages/demo/src/index/views/Demo/index.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@
280280
},
281281
handleCancel() {},
282282
handlePreview() {
283-
const formatStr = jsonCode => encodeURIComponent(JSON.stringify(JSON.parse(jsonCode)));
283+
const formatStr = jsonCode => JSON.stringify(JSON.parse(jsonCode));
284284
285285
const genRoute = this.$router.resolve({
286286
query: {

‎packages/demo/src/schema-generator/views/editor/Editor.vue

+13-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
},
208208
handlePreview() {
209209
const props = this.getExportCode();
210-
componentWithDialog({
210+
const instance = componentWithDialog({
211211
VueComponent: VueJsonFrom,
212212
dialogProps: {
213213
title: '预览展示',
@@ -216,6 +216,18 @@
216216
componentProps: {
217217
value: {},
218218
...props
219+
},
220+
componentListeners: {
221+
toDemo: () => {
222+
this.handleToDemo();
223+
},
224+
'on-cancel': () => {
225+
instance.close();
226+
},
227+
'on-submit': (data) => {
228+
// eslint-disable-next-line no-alert
229+
alert(JSON.stringify(data, null, 2));
230+
}
219231
}
220232
});
221233
},

‎packages/demo/src/schema-generator/views/editor/viewComponents/MultiSelect/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ export default {
3939
schemaOptions: {
4040
type: 'object',
4141
properties: {
42+
uniqueItems: {
43+
type: 'boolean',
44+
'ui:widget': 'hidden',
45+
default: true
46+
},
4247
items: {
4348
type: 'object',
4449
properties: {

‎packages/demo/src/schema-generator/views/editor/viewComponents/genSchema.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ function genBaseVal(type = 'string') {
4545
},
4646
uniqueItems: {
4747
type: 'boolean',
48-
title: '不允许重复项',
48+
title: '不重复',
49+
description: '多选框强制默认为 true,且配置无效',
4950
'ui:widget': 'el-switch',
5051
default: false
5152
}

0 commit comments

Comments
 (0)