<template>
    <div class="list-group">
        <a herf= "#"
           :id="'vc-tree-'+attach+'-'+row.data.name"
           v-for='row in toNode'
           @click="select(row)"
           class="list-group-item item-text-color"
           v-bind:class="{ 'active': isSelected(row), 'father': isFolder(row) }"
           transition="expand"
           v-if='isClick'
        >
            <!-- style="background-color: #bdcde4; color: #556b97;" -->
            <span v-for='n of row.level'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
            <span v-if="isFolder(row)" @click.stop="toggle(row)" :id="'vc-tree-'+attach+'-'+row.data.name+'-'+$index">
        <span v-bind:class="{ 'glyphicon glyphicon-chevron-down': row.open, 'glyphicon glyphicon-chevron-right': !row.open }"></span>
	     </span>
            <partial name='default'></partial>
        </a>
        <a herf= "#"
           :id="'vc-tree-'+attach+'-'+row.data.name"
           v-for='row in toNode'
           @click.stop="isFolder(row) ? toggle(row) : select(row)"
           class="list-group-item item-text-color"
           v-bind:class="{ 'active': isSelected(row), 'father': isFolder(row) }"
           transition="expand"
           v-if='!isClick'
        >
            <!-- style="background-color: #bdcde4; color: #556b97;" -->
            <span v-for='n of row.level'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
            <partial name='default'></partial>
        </a>
        <span v-if='row && row.state === "错误"'>x</span>
    </div>
</template>

<script>
    import Selector from './selector'
    import TreeMixin from './TreeMixin'

    export default {
      props: {
        isClick: {
          default: true
        },
        isEdit: {
          default: false
        },
        attach: {
          type: String,
          default: 'name'
        }
            // isSpread: {
            //   default: false
            // }
      },
        // ready () {
        //   this.spread(this.model)
        // },
        // methods: {
        //   spread (arr) {
        //     this.defaultSp(arr)
        //   }
        // },
      mixins: [Selector, TreeMixin]
    }
</script>
