<template>
  <div :style="{ width: record.options.width }">
    <a-button
      @click="mindFlag = true"
      type="primary"
    >打开脑图</a-button>
    <ych-modal
      :fullscreen="false"
      :maskClosable="false"
      :visible="mindFlag"
      :footer="null"
      @cancel="mindFlag = false"
      :destroyOnClose="true">
      <k-bmind
        :ref="record.tableName"
        v-bind="$attrs"
        :value="value"
        @change="changeValue"
        :recordConfig="record"
        :disabled="record.options.disabled"
      />
    </ych-modal>
  </div>
</template>
<script>

import KBmind from "../KBmind/KBmind";

export default {
  name: 'mindButton',
  data () {
    return {
      mindFlag: false,
      dataSource: [],
    }
  },
  components: {
    KBmind
  },
  props: {
    record: {
      type: Object,
      required: true,
    },
    value: {
      type: String,
    },
    dictMap: {
      type: Object,
      default: () => {
      }
    },
  },
  methods: {
    changeValue(value){
      this.$emit('change', JSON.stringify(value))
      this.$emit('input', JSON.stringify(value))
    }
  }
}
</script>
