vue使用总结 class ,v-if反向判定,且:&&,或:||
1 ,vue中class根据变量值是否为none,决定是否展现div<div :class="form.id_tag_SetReplicationTo2?'border-class':''">注意:不是:class="{{form.id_tag_SetReplicationTo2}}?'border-class':''" 而是直接使用2,vue中v-if 反向判定<i class
·
1 ,vue中class根据变量值是否为none,决定是否展现div
<div :class="form.id_tag_SetReplicationTo2?'border-class':''">
注意:不是:class="{{form.id_tag_SetReplicationTo2}}?'border-class':''" 而是直接使用
2,vue中v-if 反向判定
<i class="el-icon-download iclass" v-if="!form.id_tag_SetReplicationTo2"></i>
直接加!是可以的
3,vue/JS中 并且 或者的使用
<span class="rule-name-margin rule-span"
:class="('disable' in data && 'Delete' in data.disable && (data.disable.Delete==1 ||data.disable.Delete=='1')) ?'disaber':''"
v-if=" 'Delete' in data.actions"> 删: <span
class="rule-value">{[ data.actions["Delete"] ]}</span></span>
且:&&
或:||
4,Vue/JS中 if elseif 的使用
if(action_name=="Delete"){
this.remove_part="删除配置"
this.remove_ids=[]
this.remove_ids=[].concat(ids)
}else if(action_name=="Set1"){
this.remove_part="设置1"
this.remove_ids=[]
this.remove_ids=[].concat(ids)
}
else if(action_name=="all"){
this.remove_part="全部配置"
this.remove_ids=[]
this.remove_ids=[].concat(ids).filter(
function(s){
if(s){return s}}
)
}
python 中是if...elif...else..
更多推荐
已为社区贡献1条内容
所有评论(0)