比如下面的代码,我想进行 if(this.a == ture)判断才写上,否则就不写,怎么写?
还是说,只能这样判断
render:(h, params){
if(this.a==true){
return h('div', [
h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '5px'
},
on: {
click: () => {
this.bookMn(params.index)
}
}
}, '管理'),
h('Button', {
props: {
type: 'success',
size: 'small'
},
style: {
marginRight: '5px'
},
on: {
click: () => {
this.nextpage(params.index)
}
}
}, '正文'),
...
}else{
h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '5px'
},
on: {
click: () => {
this.bookMn(params.index)
}
}
}, '管理'),
...
}
}
}
这样感觉要写好多重复的。。。
不知道还有没有别的思路,望大神赐教~~~
对<部分falsity>值,不会进行渲染 , 路过,乱说一波``