<template>
  <el-select clearable :value="value" @change="handleChange" clearable placeholder="请选择产品">
    <el-option
        v-for="item in list"
        :key="item.productName"
        :label="item.productNameStr"
        :value="item.productName"></el-option>
  </el-select>
</template>

<script type="text/ecmascript-6">
  export default {
    name: 'ProductSelect',
    props: {
      value: {
        type: String,
        required: false
      }
    },
    data() {
      return {
        list:[]
      }
    },
   async created() {
     const res = await this.$$get('/back/selectProductList');
     if(res.status===200 && res.data.success){
       this.list = res.data.result;
     }
    },
    methods: {
      handleChange(e){
        this.$emit('handleSetting',e)
      }
    }
  }
</script>
