<template>

  <el-select
    v-model="value"
    class="multi-select"
    placeholder="下单渠道"
    clearable
    filterable
    :multiple="multiple"
    :size="size"
    @change="updateValue"
  >
    <el-option
      v-for="item in data"
      :key="item.Id"
      :label="item.Name"
      :value="item.Id"
    />
  </el-select>
</template>

<script>
import { _getChannel } from '@/api/baseInfo'
export default {
  name: 'DeliveryChannel',
  props: ['model', 'enumName', 'multiple', 'size', 'url'],
  data() {
    return {
      data: [],
      value: ''
    }
  },
  watch: {
    'model'(newVal, oldVal) {
      this.value = newVal
    }
  },
  mounted() {
    this.value = this.model
    _getChannel().then(r => { this.data = r })
  },
  methods: {
    updateValue(v) {
      this.$emit('update:model', v)
      this.$emit('change', v)
    }

  }
}
</script>
