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.
iot/projects/WebMVC/wwwroot/components/shared/edit/selectlist.html

26 lines
827 B

<template>
<div>
<select class="form-control" :id="name" :name="currentName" v-model="currentValue">
<option :value="null">请选择</option>
<option v-for="item in list" :value="item.value">{{item.text}}</option>
</select>
</div>
</template>
<script>
export default {
props: ['prefix', 'name', 'value', 'data'],
data: function () {
return {
currentName: this.prefix ? (this.prefix + '.' + this.name) : this.name,
currentValue: this.value,
list: this.data[this.name + 'SelectList']
};
},
watch: {
currentValue(val) {
this.$emit('update:value', val);
this.$emit('change', this.name);
}
},
};
</script>