<template>
  <div class="docs-select-box">
    <hive-select :value="value" :multiple="true" :data-source="options" @filter="onFilter" ></hive-select>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        value: [
          { value: 0, label: '已保存0' },
          { value: 1, label: '已保存1' },
        ],
        options: [],
      };
    },
    methods: {
      onFilter(text) {
        clearTimeout(this.T);
        if (!text) {
          this.options = [];
          return;
        }
        const options = new Array(parseInt(Math.random() * 10 + 1)).fill(0).map((item, i) => ({ value: text + i, label: '远程数据' + text + i }));
        this.T = setTimeout(() => {
          this.options = options;
        }, 500);
      },
    },
  };
</script>
