美文网首页
vue中computed计算属性传入参数

vue中computed计算属性传入参数

作者: Cherry丶小丸子 | 来源:发表于2021-03-01 17:47 被阅读0次
<template slot-scope="scope">
    <div :name="getFirstName(scope.row.firstName)"></div>
    <div :name="getAllName(scope.row.firstName, scope.row.lastName)"></div>
</template>

computed:{
    getFirstName(){
        return firstName => {
            console.log(firstName)
            return firstName
        }
    },
    getAllName(){
        return (firstName, lastName)=> {
            console.log(firstName, lastName)
            return `${firstName}${lastName}`
        }
    }
}

相关文章

网友评论

      本文标题:vue中computed计算属性传入参数

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