|
13 | 13 | :class="{active: selectWg.key === item.key,'widget-view-imgshow':item.type === 'imgshow'}" |
14 | 14 | @click="handleSelectWidget(index)" |
15 | 15 | > |
| 16 | + <!-- 手机 --> |
16 | 17 | <div v-if="item.type === 'phone'" class="wg-phone" :style="item.style"> |
17 | 18 | <div class="wg-item" :class="[item.labelPosition==='top'?'flex-column':'align-middle']"> |
18 | 19 | <div class="wg-title" :style="{width:item.labelWidth}" v-show="item.showLabel">{{item.labelTitle}}</div> |
|
29 | 30 | </div> |
30 | 31 | </div> |
31 | 32 |
|
| 33 | + <!-- 输入框 --> |
32 | 34 | <div v-if="item.type === 'input'" class="wg-item" :class="[item.labelPosition==='top'?'flex-column':'align-middle']" :style="item.style"> |
33 | 35 | <div class="wg-title" :style="{width:item.labelWidth}" v-show="item.showLabel">{{item.labelTitle}}</div> |
34 | 36 | <div class="flex-auto"> |
35 | 37 | <input v-model="item.value" :placeholder="item.placeholder" class="wg-input"> |
36 | 38 | </div> |
37 | 39 | </div> |
38 | 40 |
|
| 41 | + <!-- 选择框 --> |
39 | 42 | <div |
40 | 43 | v-if="item.type === 'checkbox'" |
41 | 44 | class="wg-item flex-wrap wg-checkbox" |
|
51 | 54 | </div> |
52 | 55 | </div> |
53 | 56 |
|
| 57 | + <!-- 下拉选择 --> |
54 | 58 | <div v-if="item.type === 'select'" class="wg-item" :class="[item.labelPosition==='top'?'flex-column':'align-middle']" :style="item.style"> |
55 | 59 | <div class="wg-title" :style="{width:item.labelWidth}" v-show="item.showLabel">{{item.labelTitle}}</div> |
56 | 60 | <div class="flex-auto"> |
57 | 61 | <select v-model="item.value" class="wg-select flex-auto"> |
58 | 62 | <option value disabled selected hidden>{{item.placeholder}}</option> |
59 | | - <option v-for="item in item.options" :key="item" :value="item" :label="item.showLabel?item.label:item"></option> |
| 63 | + <option v-for="optionsItem in item.options" :key="optionsItem" :value="optionsItem" :label="item.showLabel?item.label:optionsItem"></option> |
60 | 64 | </select> |
61 | 65 | </div> |
62 | 66 | </div> |
63 | 67 |
|
64 | | - <div v-if="item.type==='switch'" class="wg-item wg-switch" :class="[item.labelPosition==='top'?'flex-column':'align-middle']" :style="item.style"> |
| 68 | + <!-- 开关 --> |
| 69 | + <div |
| 70 | + v-if="item.type==='switch'" |
| 71 | + class="wg-item wg-switch" |
| 72 | + :class="[item.labelPosition==='top'?'flex-column':'align-middle']" |
| 73 | + :style="item.style" |
| 74 | + > |
65 | 75 | <div class="wg-title" :style="{width:item.labelWidth}">{{item.labelTitle}}</div> |
66 | 76 | <label class="label"> |
67 | 77 | <input type="checkbox" class="wg-switch-input" v-model="item.value" style="display:none"> |
68 | 78 | <span class="wg-switch-core"></span> |
69 | 79 | </label> |
70 | 80 | </div> |
71 | 81 |
|
| 82 | + <!-- 日期选择 --> |
72 | 83 | <div v-if="item.type === 'date'" class="wg-item" :class="[item.labelPosition==='top'?'flex-column':'align-middle']" :style="item.style"> |
73 | 84 | <div class="wg-title" :style="{width:item.labelWidth}">{{item.labelTitle}}</div> |
74 | 85 | <div class="flex-auto"> |
75 | 86 | <input type="date" v-model="item.value" class="wg-input flex-auto"> |
76 | 87 | </div> |
77 | 88 | </div> |
78 | 89 |
|
| 90 | + <!-- 图片展示 --> |
79 | 91 | <div class="flex flex-center" v-if="item.type === 'imgshow'" :class="{'img-placeholder':!item.value}" :style="item.style"> |
80 | 92 | <img v-if="item.value" :src="item.value" alt="图片展示" width="100%"> |
81 | 93 | <img v-else src="@/assets/img/img-placeholder.png" alt="图片展示"> |
82 | 94 | </div> |
83 | 95 |
|
| 96 | + <!-- 按钮 --> |
84 | 97 | <div class="flex flex-center" v-if="item.type === 'button'" :style="item.style"> |
85 | 98 | <button class="wg-button" :style="item.style.btnStyle">{{item.btnText}}</button> |
86 | 99 | </div> |
87 | 100 |
|
| 101 | + <!-- 文本描述 --> |
88 | 102 | <div v-if="item.type === 'staticText'" class="wg-staticText" :style="item.style"> |
89 | 103 | <p :style="item.style">{{item.value}}</p> |
90 | 104 | </div> |
91 | 105 |
|
| 106 | + <!-- 横向滑动自动选择 --> |
| 107 | + <div class="flex flex-center" v-if="item.type === 'h-picker'" :style="item.style"> |
| 108 | + <div class="wg-horizontal-picker"> |
| 109 | + <div |
| 110 | + class="picker-item" |
| 111 | + v-for="optionsItem in item.options" |
| 112 | + :key="optionsItem" |
| 113 | + :style="optionsItem===item.value?{ color: optionsItem.pickerColor }:{}" |
| 114 | + >{{optionsItem}}</div> |
| 115 | + </div> |
| 116 | + </div> |
| 117 | + |
92 | 118 | <el-button |
93 | 119 | title="删除" |
94 | 120 | @click.stop="handleWidgetDelete(index)" |
|
98 | 124 | plain |
99 | 125 | type="danger" |
100 | 126 | >删除</el-button> |
101 | | - <el-button title="复制" @click.stop="handleWidgetClone(index)" class="widget-action-clone" v-if="selectWg.key === item.key" circle plain type="primary">复制</el-button> |
| 127 | + <el-button |
| 128 | + title="复制" |
| 129 | + @click.stop="handleWidgetClone(index)" |
| 130 | + class="widget-action-clone" |
| 131 | + v-if="selectWg.key === item.key" |
| 132 | + circle |
| 133 | + plain |
| 134 | + type="primary" |
| 135 | + >复制</el-button> |
102 | 136 | </div> |
103 | 137 | </template> |
104 | 138 | </draggable> |
|
0 commit comments