<template>
  <div>
    <Tree :data="treeData" @on-select-change="selectChange" ref="tree" :render="renderContent"></Tree>
  </div>
</template>
<script>
export default {
  name: "TreeSelect",
  props: {
    // currentStaData: {
    //   type: Array,
    //   default: () => {
    //     return [];
    //   }
    // },
    defaultData: {
      type: Array,
      default: () => {
        return [];
      }
    },
    firstCalssName: {
      type: String,
      default: 'icon-hefeiditie'
    },
    secondCalssName: {
      type: String,
      default: 'icon-sutpczhihuizhantai'
    },
    thirdCalssName: {
      type: String,
      default: 'icon-ditiezhaofang'
    },
  },
  data() {
    return {
      treeData: [],
      selectVal: '',
    };
  },
  // watch: {
  //   defaultData: {
  //   　handler(newValue, oldValue) {
  //       this.treeData = newValue;
  //   },　
  //  }
  // },
  mounted() {
    this.treeData = this.defaultData;
  },
  methods: {
    selectChange(option) { 
      this.$emit('treeSelectChange',option)
    },
  }
}

</script>
<style scoped lang="stylus">
>>> .ivu-tree-arrow {
  color: #41aeff;
  // height: 30px;
  // line-height: 30px;
  width: 15px;
}
>>> .ivu-tree-children li {
  // width: 100%;
}
>>> .ivu-tree-title {
  color: #fff;
  min-width: 90%;
  padding: 6px 4px;
  vertical-align: middle;
}
>>> .ivu-tree-title:hover {
    background-color: transparent;
}
>>> .ivu-tree-title-selected, >>> .ivu-tree-title-selected:hover {
  background-color: #3565BC;
  // background-color: transparent;
  color: #fff;
}
>>> .ivu-tree-title img {
  width: 18px;
  height: 18px;
}
// >>> .ivu-tree .ivu-icon {// 禁止旋转
//   -webkit-transform: rotate(0deg);
//   transform: rotate(0deg);
// }
// >>> .ivu-tree .ivu-icon-ios-arrow-forward:before { //改变tree默认折叠的三角箭头
//     background: url('../../assets/images/yu.png') no-repeat 0 3px;
//     content: '';
//     display: block;
//     width: 16px;
//     height: 16px;
//     font-size: 16px;
//     background-size: 16px;
// }
// >>> .ivu-tree .ivu-tree-arrow-open .ivu-icon-ios-arrow-forward:before { //改变tree默认展开的三角箭头
//     background: url('../../assets/images/warning.png') no-repeat 0 0px;
//     content: '';
//     display: block;
//     width: 16px;
//     height: 16px;
//     font-size: 16px;
//     background-size: 16px;
// }
</style>
