1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
| <template>
| <div class="jzdItem">
| <draggable v-model="jzd" v-bind="{group:'item'}" handle=".jzd-handle">
| <el-row v-for="(item,i) in jzd" :key="i">
| <el-col :span="10">
| <el-form-item style="margin-bottom:3px !important">
| <el-input v-model="item.key" placeholder="选项名称"/>
| </el-form-item>
| </el-col>
| <el-col :span="8">
| <el-form-item style="margin-bottom:3px !important">
| <el-input style="position:relative;left:5px;" v-model="item.val" placeholder="选项值"/>
| </el-form-item>
| </el-col>
| <el-col :span="4">
| <el-button type="danger" size="mini" style="position:relative;left:15px" icon="el-icon-close" @click="deleteItem(i)"></el-button>
| <el-button class="jzd-handle" type="success" size="mini" style="position:relative;left:15px" icon="el-icon-rank"></el-button>
| </el-col>
| </el-row>
| </draggable>
| <div>
| <el-button type="info" icon="el-icon-plus" style="padding:5px 7px" size="mini" @click="addItem">追加</el-button>
| <el-button v-if="jzd.length > 0" type="warning" icon="el-icon-delete" style="padding:5px 7px" size="mini" @click="clearItem">清空</el-button>
| </div>
| </div>
| </template>
| <script>
| import draggable from "vuedraggable"
| export default {
| components:{
| draggable,
| },
| props: {
| item:{
| type: Array,
| },
| },
| watch:{
| jzd(){
| this.$emit('update:item',this.jzd)
| },
| },
| data(){
| return{
| jzd:this.item
| }
| },
| methods: {
| addItem(){
| this.jzd.push({})
| },
| deleteItem(index){
| this.jzd.splice(index,1)
| },
| clearItem(){
| this.jzd = []
| },
| }
|
| };
| </script>
|
|