Skip to content

Commit

Permalink
fix(schema generator): 多选类型强制 uniqueItems
Browse files Browse the repository at this point in the history
  • Loading branch information
lljj-x committed Nov 25, 2020
1 parent ff0d2da commit cd3349e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"packages:list": "lerna ls -l",
"packages:changed": "lerna changed",
"packages:build": "lerna run --stream --sort build",
"publish": "yarn run lib:build && lerna publish",
"publish1": "yarn run lib:build && lerna publish",
"autoPublish": "lerna publish --conventional-commits --yes",
"autoVersion": "lerna version --conventional-commits --yes"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/demo/src/index/views/Demo/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
},
handleCancel() {},
handlePreview() {
const formatStr = jsonCode => encodeURIComponent(JSON.stringify(JSON.parse(jsonCode)));
const formatStr = jsonCode => JSON.stringify(JSON.parse(jsonCode));
const genRoute = this.$router.resolve({
query: {
Expand Down
14 changes: 13 additions & 1 deletion packages/demo/src/schema-generator/views/editor/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
},
handlePreview() {
const props = this.getExportCode();
componentWithDialog({
const instance = componentWithDialog({
VueComponent: VueJsonFrom,
dialogProps: {
title: '预览展示',
Expand All @@ -216,6 +216,18 @@
componentProps: {
value: {},
...props
},
componentListeners: {
toDemo: () => {
this.handleToDemo();
},
'on-cancel': () => {
instance.close();
},
'on-submit': (data) => {
// eslint-disable-next-line no-alert
alert(JSON.stringify(data, null, 2));
}
}
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ export default {
schemaOptions: {
type: 'object',
properties: {
uniqueItems: {
type: 'boolean',
'ui:widget': 'hidden',
default: true
},
items: {
type: 'object',
properties: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ function genBaseVal(type = 'string') {
},
uniqueItems: {
type: 'boolean',
title: '不允许重复项',
title: '不重复',
description: '多选框强制默认为 true,且配置无效',
'ui:widget': 'el-switch',
default: false
}
Expand Down

0 comments on commit cd3349e

Please sign in to comment.