Commit 08ec6786e1aafb712dab9e65a42d6aaec445c480
1 parent
6de24470
update checkbox & radio plugin props editor
Showing
3 changed files
with
5 additions
and
109 deletions
front-end/h5/src/components/core/support/prop-multi-items-editor/text.js
| ... | ... | @@ -5,9 +5,9 @@ export default { |
| 5 | 5 | { |
| 6 | 6 | this.innerItems.map((item, index) => ( |
| 7 | 7 | <div> |
| 8 | - <a-input value={item.value} onChange={e => { item.value = e.target.value }}></a-input> | |
| 9 | - <a-button type="dashed" shape="circle" icon="plus" onClick={this.add} /> | |
| 10 | - <a-button type="dashed" shape="circle" icon="minus" onClick={(item, index) => this.minus(item, index)} /> | |
| 8 | + <a-input value={item.value} onChange={e => { item.value = e.target.value }} style={{ width: '70%' }}></a-input> | |
| 9 | + <a-icon type="plus-circle" onClick={this.add} class="ml-2" /> | |
| 10 | + <a-icon type="minus-circle" onClick={(item, index) => this.minus(item, index)} class="ml-1"></a-icon> | |
| 11 | 11 | </div> |
| 12 | 12 | )) |
| 13 | 13 | } | ... | ... |
front-end/h5/src/components/plugins/lbp-form-checkbox-group.js
| ... | ... | @@ -32,7 +32,7 @@ export default { |
| 32 | 32 | type: Array, |
| 33 | 33 | default: () => defaultItems, |
| 34 | 34 | editor: { |
| 35 | - type: 'lbs-form-radio-items-editor', | |
| 35 | + type: 'lbs-prop-text-enum-editor', | |
| 36 | 36 | label: '选项列表', |
| 37 | 37 | require: true, |
| 38 | 38 | defaultPropValue: defaultItems |
| ... | ... | @@ -76,58 +76,6 @@ export default { |
| 76 | 76 | this.value = type === 'radio' ? '' : [] |
| 77 | 77 | } |
| 78 | 78 | }, |
| 79 | - editorConfig: { | |
| 80 | - components: { | |
| 81 | - 'lbs-form-radio-items-editor': { | |
| 82 | - render () { | |
| 83 | - return <div> | |
| 84 | - { | |
| 85 | - this.value_.map((item, index) => ( | |
| 86 | - <div> | |
| 87 | - <a-input value={item.value} onChange={e => { item.value = e.target.value }}></a-input> | |
| 88 | - <a-button type="dashed" shape="circle" icon="plus" onClick={this.add} /> | |
| 89 | - <a-button type="dashed" shape="circle" icon="minus" onClick={(item, index) => this.minus(item, index)} /> | |
| 90 | - </div> | |
| 91 | - )) | |
| 92 | - } | |
| 93 | - </div> | |
| 94 | - }, | |
| 95 | - props: { | |
| 96 | - value: { | |
| 97 | - type: Array, | |
| 98 | - default: () => defaultItems | |
| 99 | - } | |
| 100 | - }, | |
| 101 | - computed: { | |
| 102 | - value_: { | |
| 103 | - get () { | |
| 104 | - return this.value | |
| 105 | - }, | |
| 106 | - set (val) { | |
| 107 | - this.$emit('input', val) | |
| 108 | - } | |
| 109 | - } | |
| 110 | - }, | |
| 111 | - methods: { | |
| 112 | - add () { | |
| 113 | - console.log(this.value_.length) | |
| 114 | - this.$emit('change', [ | |
| 115 | - ...this.value_, | |
| 116 | - { | |
| 117 | - value: `选项${this.value_.length + 1}`, | |
| 118 | - label: `选项${this.value_.length + 1}-label` | |
| 119 | - } | |
| 120 | - ]) | |
| 121 | - }, | |
| 122 | - minus (item, index) { | |
| 123 | - const items = this.value_.slice(0) | |
| 124 | - items.splice(index, 1) | |
| 125 | - this.$emit('change', items) | |
| 126 | - } | |
| 127 | - } | |
| 128 | - } | |
| 129 | - } | |
| 130 | - }, | |
| 131 | 79 | mounted () { |
| 132 | 80 | this.uuid = this.$el.dataset.uuid |
| 133 | 81 | }, | ... | ... |
front-end/h5/src/components/plugins/lbp-form-radio-group.js
| ... | ... | @@ -29,7 +29,7 @@ export default { |
| 29 | 29 | type: Array, |
| 30 | 30 | default: () => defaultItems, |
| 31 | 31 | editor: { |
| 32 | - type: 'lbs-form-radio-items-editor', | |
| 32 | + type: 'lbs-prop-text-enum-editor', | |
| 33 | 33 | label: '选项列表', |
| 34 | 34 | require: true, |
| 35 | 35 | defaultPropValue: defaultItems |
| ... | ... | @@ -73,58 +73,6 @@ export default { |
| 73 | 73 | this.value = type === 'radio' ? '' : [] |
| 74 | 74 | } |
| 75 | 75 | }, |
| 76 | - editorConfig: { | |
| 77 | - components: { | |
| 78 | - 'lbs-form-radio-items-editor': { | |
| 79 | - render () { | |
| 80 | - return <div> | |
| 81 | - { | |
| 82 | - this.value_.map((item, index) => ( | |
| 83 | - <div> | |
| 84 | - <a-input value={item.value} onChange={e => { item.value = e.target.value }} style={{ width: '70%' }}></a-input> | |
| 85 | - <a-icon type="plus-circle" onClick={this.add} class="ml-2" /> | |
| 86 | - <a-icon type="minus-circle" onClick={(item, index) => this.minus(item, index)} class="ml-1"></a-icon> | |
| 87 | - </div> | |
| 88 | - )) | |
| 89 | - } | |
| 90 | - </div> | |
| 91 | - }, | |
| 92 | - props: { | |
| 93 | - value: { | |
| 94 | - type: Array, | |
| 95 | - default: () => defaultItems | |
| 96 | - } | |
| 97 | - }, | |
| 98 | - computed: { | |
| 99 | - value_: { | |
| 100 | - get () { | |
| 101 | - return this.value | |
| 102 | - }, | |
| 103 | - set (val) { | |
| 104 | - this.$emit('input', val) | |
| 105 | - } | |
| 106 | - } | |
| 107 | - }, | |
| 108 | - methods: { | |
| 109 | - add () { | |
| 110 | - console.log(this.value_.length) | |
| 111 | - this.$emit('change', [ | |
| 112 | - ...this.value_, | |
| 113 | - { | |
| 114 | - value: `选项${this.value_.length + 1}`, | |
| 115 | - label: `选项${this.value_.length + 1}-label` | |
| 116 | - } | |
| 117 | - ]) | |
| 118 | - }, | |
| 119 | - minus (item, index) { | |
| 120 | - const items = this.value_.slice(0) | |
| 121 | - items.splice(index, 1) | |
| 122 | - this.$emit('change', items) | |
| 123 | - } | |
| 124 | - } | |
| 125 | - } | |
| 126 | - } | |
| 127 | - }, | |
| 128 | 76 | mounted () { |
| 129 | 77 | this.uuid = this.$el.dataset.uuid |
| 130 | 78 | }, | ... | ... |