美文网首页
Vue this.$emit() 返回值

Vue this.$emit() 返回值

作者: Cherry丶小丸子 | 来源:发表于2022-07-03 11:42 被阅读0次
子组件
methods: {
    getName(){
        this.$emit('callParentFunction', file, fileList, val => {
            console.log(val)  // 小明
        })
    }
}
父组件
data(){
    return {
        name: '小明'
    }
}
methods: {
    callParentFunction(file, fileList, callBack){
        console.log(file)
        console.log(file)
        callBack(this.name)
    }
}

相关文章

网友评论

      本文标题:Vue this.$emit() 返回值

      本文链接:https://www.haomeiwen.com/subject/hqblbrtx.html