weight-select.vue 790 Bytes
Newer Older
邓春圆's avatar
邓春圆 committed
1 2
<template>
    <div style="min-width: 100px;width: 100%;">
3
      <el-select @change="(e) =>{$emit('change',e)}" :disabled="disabled"  v-model="val">
邓春圆's avatar
邓春圆 committed
4 5 6 7 8 9 10 11 12
        <el-option v-for="(item, index) in options" :value="item.id" :key="index" :label="$l(item ,'title')" ></el-option>
      </el-select>
    </div>
</template>

<script>
export default {
  name: "weight-select",
  props:{
13 14 15 16
    disabled:{
      type:Boolean,
      default:false
    },
邓春圆's avatar
邓春圆 committed
17 18 19 20 21 22 23 24
    options:{
      type:Array,
      default:()=>[]
    },
    value:{
      type:[String,Number]
    }
  },
邓春圆's avatar
邓春圆 committed
25
  created() {
邓春圆's avatar
邓春圆 committed
26
    this.val = this.value;
邓春圆's avatar
邓春圆 committed
27
  },
邓春圆's avatar
邓春圆 committed
28 29 30 31 32 33 34 35
  data(){
    return{
      val:''
    }
  },
  watch:{
    val(){
      this.$emit('input', this.val)
邓春圆's avatar
邓春圆 committed
36 37 38
    },
    value(val){
      this.val = val;
邓春圆's avatar
邓春圆 committed
39 40 41 42 43 44 45 46
    }
  }
}
</script>

<style scoped>

</style>