<template>
  <el-cascader class="ps-cascader" :id="id" :placeholder="placeholder" v-model="inputValue" :props="props" :options="options" :clearable="clearable" :disabled="disabled" :filterable="filterable" :collapse-tags="collapseTags" @change="operaChange"></el-cascader>
</template>

<script>
export default {
  name: "PsCascader",
  props: {    
    value: {
      type: Array,
      default: () => []
    },
    options: {
      type: Array,
      default: () => []
    },
    props: {
      type: Object,
      default: () => {}
    },
    placeholder: {
      type: String,
      default: ''
    },
    disabled: {
      type: Boolean,
      default: false,
    },
    clearable: {
      type: Boolean,
      default: true,
    },
    filterable: {
      type: Boolean,
      default: false,
    },
    collapseTags: {
      type: Boolean,
      default: false,
    },
    id: { type: String, default: "" }
  },
  
  //处理v-model语法糖的emit事件
  model: {
    prop: 'value',
    event: 'handler'
  },
  watch: {
    value: {
      handler(val) {
        this.inputValue = val
      },
      immediate: true
    }
  },
  data() {
    return {
      inputValue: [],
    };
  },
  created() {

  },
  mounted() {
  },
  methods: {
    operaChange(e) {
      this.$emit('change', e)
    },
  },
};
</script>

<style></style>
