<template>
  <div id="app">
    <treeselect :options="options" :placeholder="placeholder" :normalizer="normalizer" @input="handelInput" />
  </div>
</template>

<script>
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'

export default {
  components: { Treeselect },
  props: {
    // 树状数据
    options: {
      type: Array
    },
    // 占位符
    placeholder: {
      type: String
    }
  },
  data() {
    return {

    }
  },
  methods: {
    handelInput(val) {
      this.$emit('handelGetValue', val)
    },
    normalizer(node) {
      return {
        label: node.departmentName
      }
    }
  }
}
</script>
