Skip to content

Commit

Permalink
[feature]{component}: 表单设计器加入文本组件
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Oct 24, 2019
1 parent 0fd3b39 commit 615fdef
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/components/FormDesigner/GenerateFormItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @Date: 2019-03-21 16:47:49
-->
<template>
<el-form-item :label="widget.name"
<el-form-item :label="widget.type === 'text'?'':widget.name"
:label-width="widget.name===''?'0px':''"
:prop="widget.model">
<template v-if="widget.type == 'input'">
Expand All @@ -22,7 +22,11 @@
:style="{width: widget.options.width}"
:disabled="widget.options.disabled" />
</template>

<template v-if="widget.type == 'text'">
<h4 style="text-align:center;margin:10px auto">
{{widget.name}}
</h4>
</template>
<template v-if="widget.type == 'textarea'">
<el-input :rows="5"
autosize
Expand Down
1 change: 1 addition & 0 deletions src/components/FormDesigner/WidgetConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ import 'vue-awesome/icons/th'
import 'vue-awesome/icons/sort-numeric-up'
import 'vue-awesome/icons/regular/star'
import 'vue-awesome/icons/palette'
import 'vue-awesome/icons/language';
import 'vue-awesome/icons/regular/caret-square-down'
import 'vue-awesome/icons/toggle-off'
import 'vue-awesome/icons/sliders-h'
Expand Down
8 changes: 6 additions & 2 deletions src/components/FormDesigner/WidgetFormItem.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<el-form-item v-if="element && element.key"
:class="{active: selectWidget.key == element.key, 'is_req': element.options.required}"
:label="element.name"
:label="element.type === 'text'?'':element.name"
class="widget-view "
@click.native.stop="handleSelectWidget(index)"
:label-width="element.name===''?'0px':''">
Expand All @@ -15,7 +15,11 @@
:style="{width: element.options.width}"
:placeholder="element.options.placeholder" />
</template>

<template v-if="element.type == 'text'">
<h4 style="text-align:center;margin:10px auto">
{{element.name}}
</h4>
</template>
<template v-if="element.type == 'textarea'">
<el-input :rows="5"
v-model="element.options.defaultValue"
Expand Down
5 changes: 5 additions & 0 deletions src/components/FormDesigner/componentsConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export const basicComponents = [
placeholder: '',
},
},
{
type: 'text',
name: '文本',
icon: 'language',
},
{
type: 'textarea',
name: '多行文本',
Expand Down

0 comments on commit 615fdef

Please sign in to comment.