You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.2 KiB
35 lines
1.2 KiB
<template>
|
|
<div>
|
|
<select class="col-xs-10 col-sm-5 MultiSelectList" multiple ref="select" :name="name">
|
|
<template v-for="(item,index) in list">
|
|
<option :value="item.value" :data-section="item.group.name" :data-index="index" selected v-if="item.selected">{{item.text}}</option>
|
|
<option :value="item.value" :data-section="item.group.name" :data-index="index" v-else>{{item.text}}</option>
|
|
</template>
|
|
</select>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
export default {
|
|
props: ['name', 'value', 'data'],
|
|
mounted: function () {
|
|
var select = this.$refs.select;
|
|
this.$nextTick(function () {
|
|
$(select).treeMultiselect({
|
|
enableSelectAll: true,
|
|
searchable: true,
|
|
selectAllText: "全选",
|
|
unselectAllText: "反选"
|
|
});
|
|
});
|
|
},
|
|
computed: {
|
|
list: function () {
|
|
var key = this.name;
|
|
if (this.prefix) {
|
|
key = this.name.substring(this.prefix.length + 1);
|
|
}
|
|
return this.data[key + 'SelectList'];
|
|
}
|
|
}
|
|
};
|
|
</script> |