|
@@ -2,6 +2,7 @@
|
|
|
<a-card
|
|
|
:tab-list="tabList"
|
|
|
size="small"
|
|
|
+ style="min-height:600px"
|
|
|
:active-tab-key="selectKey"
|
|
|
@tabChange="onTabChange">
|
|
|
<a-form
|
|
@@ -35,8 +36,28 @@
|
|
|
</template>
|
|
|
<!-- 下拉框 -->
|
|
|
<template v-if="model.type === 'select'">
|
|
|
- <a-form-item label="">
|
|
|
- <a-input v-model="model.min" />
|
|
|
+ <a-form-item label="选项">
|
|
|
+ <VueDraggable
|
|
|
+ v-model="model.options"
|
|
|
+ :animation="150"
|
|
|
+ handle=".handle"
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in model.options"
|
|
|
+ :key="index"
|
|
|
+ class="options"
|
|
|
+ >
|
|
|
+ <a-space>
|
|
|
+ <a-icon class="handle cursor-move" type="unordered-list" />
|
|
|
+ <a-input-group compact>
|
|
|
+ <a-input style="width:50%" v-model="item.label" />
|
|
|
+ <a-input style="width:50%" v-model="item.value" />
|
|
|
+ </a-input-group>
|
|
|
+ <a-icon type="close" @click="deleteOption(index)" />
|
|
|
+ </a-space>
|
|
|
+ </div>
|
|
|
+ </VueDraggable>
|
|
|
+ <a-button @click="addOption" style="width:100%"><a-icon type="plus" /></a-button>
|
|
|
</a-form-item>
|
|
|
</template>
|
|
|
</a-form>
|
|
@@ -65,7 +86,11 @@
|
|
|
|
|
|
<script>
|
|
|
|
|
|
+import { VueDraggable } from 'vue-draggable-plus'
|
|
|
export default {
|
|
|
+ components: {
|
|
|
+ VueDraggable
|
|
|
+ },
|
|
|
data () {
|
|
|
return {
|
|
|
model: {
|
|
@@ -92,6 +117,15 @@ export default {
|
|
|
this.model = val
|
|
|
this.config = config
|
|
|
},
|
|
|
+ addOption () {
|
|
|
+ this.model.options.push({
|
|
|
+ label: '选项' + (this.model.options.length + 1),
|
|
|
+ value: 'newValue' + (this.model.options.length + 1)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ deleteOption (i) {
|
|
|
+ this.model.options.splice(i, 1)
|
|
|
+ },
|
|
|
onTabChange (key) {
|
|
|
this.selectKey = key
|
|
|
}
|
|
@@ -99,6 +133,8 @@ export default {
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style>
|
|
|
-
|
|
|
+<style lang="less" scoped>
|
|
|
+.options{
|
|
|
+ margin-bottom:5px ;
|
|
|
+}
|
|
|
</style>
|