Commit b3e2d4a7 by 姜雷

穿梭框添加双击选择取消功能

parent 3488571b
...@@ -25,6 +25,10 @@ export default { ...@@ -25,6 +25,10 @@ export default {
id: 3, id: 3,
label: '3333', label: '3333',
}, },
{
id: 4,
label: '3223',
},
], ],
value: [], value: [],
}; };
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
v-for="(item, index) in allDataOptions" v-for="(item, index) in allDataOptions"
:key="index" :key="index"
:value="getValue('key',item)" :value="getValue('key',item)"
@dblclick="() => addClickValue(getValue('key',item))"
>{{getValue('label',item)}}</option> >{{getValue('label',item)}}</option>
</select> </select>
</div> </div>
...@@ -101,6 +102,7 @@ ...@@ -101,6 +102,7 @@
v-for="(item, index) in selectDataOptions" v-for="(item, index) in selectDataOptions"
:key="index" :key="index"
:value="getValue('key',item)" :value="getValue('key',item)"
@dblclick="() => removeClickValue(getValue('key',item))"
>{{getValue('label',item)}}</option> >{{getValue('label',item)}}</option>
</select> </select>
</div> </div>
...@@ -184,9 +186,15 @@ export default { ...@@ -184,9 +186,15 @@ export default {
filterSelectedData() { filterSelectedData() {
this.filters.selectedValue = this.filters.selected; this.filters.selectedValue = this.filters.selected;
}, },
addClickValue(val) {
this.trueValue.push(val);
},
removeClickValue(val) {
this.trueValue = this.trueValue.filter(item => item !== val);
},
addSelectedValue(flag) { addSelectedValue(flag) {
this.trueValue = flag this.trueValue = flag
? this.list.map(i => i.id) ? this.allDataOptions.map(i => i.id)
: [...this.trueValue, ...this.selected.all]; : [...this.trueValue, ...this.selected.all];
}, },
removeSelectedValue(flag) { removeSelectedValue(flag) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment