在vue项目中使用computed计算属性并传入参数

<template>
    <div v-if=isType('0')></div>  
</template>

computed:{
  isType() {
    // 需要return一个fn并接收参数
    return function(type) {
      let is = true
      if(type==='1'){
        return false
      }
      return is
    }
  },
}

评论

暂无评论