<template>
  <div class="select1">
    <p class="search__label">{{title}}:</p>
    <el-select v-model="result" :multiple="multiple" clearable @clear="clearCatory" :placeholder="`请选择${title}`" size="small" @change="change" :width="width ? width : ''">
      <el-option
        v-for="item in list"
        :key="item.value"
        :label="item.label"
        :value="item.value">
      </el-option>
    </el-select>
  </div>
</template>

<script>
export default {
  name: '',
  data() {
    return {
      result:this.defalut == true ? this.list[0] ? [this.list[0].value] : '' : ''
    };
  },
  props: {
    title: String,
    list: Array,
    defalut: Boolean,
    multiple: {
      type: Boolean,
      default:() => false
    },
    width: {
      type: String,
    }
  },
  computed:{
  },
  watch:{
  },
  mounted() {
    console.log(this.list);
    
  },
  methods: {
    change() {
      this.$emit('selectChange',this.result)
    },
    clearCatory() {
      this.$emit('clearCategory')
    }
  },
};
</script>

<style scoped>
  .select1 {
    display: flex;
    align-items: center;
  }
</style>
