Vue递归组件传值

<template>  
      <li>
        <div
            :class="{bold: isFolder}"
            class=" vux-1px-b treeItem_name"
            @click.stop.self="sendSelect(model)"
            @dblclick="changeType">
            {{model.name}}
            <span v-if="isFolder" @click.stop="toggle" :class="open ? 'open' : 'close'">[{{open ? '-' : '+'}}]</span>
        </div>
        <ul v-show="open" v-if="isFolder">
            <treeItem
                class="treeItem  p-l-10"
                v-for="model in model.children"
                :model="model"
                @treeItemData="getTreeItem"
                >
            </treeItem>
        </ul>
    </li>
</template>

<script>  
    export default {
        name:"treeItem",
        props: {
            model: Object
        },
        data: function () {
            return {
                open: false,
                treeData:{}
            }
        },
        computed: {
            isFolder: function () {
            return this.model.children &&
                this.model.children.length
            }
        },
        methods: {
            toggle: function () {
                if (this.isFolder) {
                    this.open = !this.open
                }
            },
            changeType: function () {
                if (!this.isFolder) {
                    Vue.set(this.model, 'children', [])
                    this.addChild()
                    this.open = true
                }
            },
            sendSelect: function(item){
                this.treeData = item;
                this.$emit('treeItemData',item)
            },
            getTreeItem: function(item){
                this.$emit('treeItemData',item)
            }
        }
    }
</script>

= 子传父需要在子组件中再$emit一次 =