<template>
  <div>
    <treeselect
      v-model="value"
      :multiple="multiple"
      :options="options"
      placeholder="请选择时间节点"
      no-results-text="没有结果"
    />
  </div>
</template>

<script>
// import the component
// import Treeselect from '@riophae/vue-treeselect';
// import the styles
// import '@riophae/vue-treeselect/dist/vue-treeselect.css';
export default {
  components: {
    // Treeselect,
  },
  // props: ['multiple', 'options'],
  props: {
    multiple: {
      type: Boolean,
    }, 
    options: {
      type: Array,
      default: () => [],
    },
  },

  emits: ['valueChanged'],

  data: function () {
    return {
      value: undefined,
    };
  },

  watch: {
    value: function (curVal, oldVal) {
      this.$emit('valueChanged', curVal);
    },
  },
  methods: {
    /**
     * 获取选中的值
     */
    getValue: function () {
      return this.value;
    },

    /**
     * 设置值
     * @param {Object} value
     */
    setValue: function (value) {
      this.value = value;
    },
  },
};
</script>

<style>
</style>