state: {
butto:{
xian:true,
cang:false,
},
},
export default {
inserted(el,binding,vnode){
let zhi=binding.value;
let content=vnode.child.$store.state.butto[zhi]
!content && el.parentNode.removeChild(el)
}
}
<el-button type="primary" v-haha="qaz==1?'cang':'xian'">新增</el-button>
<el-button type="primary" v-haha="qaz==1?'xian':'cang'">新增11</el-button>
<el-button type="primary" v-haha="'xian'">编辑</el-button>
<el-button type="primary" v-haha="'cang'">删除</el-button>
import haha from '../components/zhiling'
directives: {haha},
data() {
return {
qaz:1,
}
},
<div v-if="edc">
<el-button type="primary" disabled>禁用</el-button>
</div>
<div v-else>
<el-button type="primary">非禁用</el-button>
</div>
<el-button type="primary" @click="btn">点击</el-button>
data() {
return {
edc:true
}
},
methods: {
btn(){
this.edc=!this.edc
}
},