Skip to content

Commit

Permalink
feat(iview3): 适配 iview
Browse files Browse the repository at this point in the history
  • Loading branch information
lljj-x committed Dec 28, 2020
1 parent f8b59ce commit c969d97
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const {
export default {
types: {
boolean: 'el-switch',
string: 'el-input',
number: 'el-input-number',
integer: 'el-input-number',
string: 'i-input',
number: 'input-number',
integer: 'input-number',
},
formats: {
color: 'el-color-picker',
color: 'color-picker',
time: TimePickerWidget, // 20:20:39+00:00
date: DatePickerWidget, // 2018-11-13
'date-time': DateTimePickerWidget, // 2018-11-13T20:20:39+00:00
Expand Down
18 changes: 8 additions & 10 deletions packages/lib/vue2-form-iview3/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ const JsonSchemaForm = createVue2Core(Object.freeze({
form: {
functional: true,
render(h, context) {
const labelWidth = (context.data.props.labelPosition === 'top' || !context.data.props.labelWidth || !context.data.props)
? undefined
: parseFloat(String(context.data.props.labelWidth));

context.data.props = {
...context.data.props,
labelWidth
labelWidth: (context.data.props.labelPosition === 'top' || !context.data.props.labelWidth)
? undefined
: parseFloat(String(context.data.props.labelWidth))
};

return h('i-form', context.data, context.children);
Expand Down Expand Up @@ -68,11 +66,11 @@ const JsonSchemaForm = createVue2Core(Object.freeze({
},
}),
ICONS_MAP: Object.freeze({
question: 'el-icon-question',
moveUp: 'el-icon-caret-top',
moveDown: 'el-icon-caret-bottom',
close: 'el-icon-close',
plus: 'el-icon-plus'
question: 'ivu-icon ivu-icon-md-help-circle',
moveUp: 'ivu-icon ivu-icon-md-arrow-round-up',
moveDown: 'ivu-icon ivu-icon-md-arrow-round-down',
close: 'ivu-icon ivu-icon-md-close',
plus: 'ivu-icon ivu-icon-md-add'
})
}));

Expand Down

0 comments on commit c969d97

Please sign in to comment.