Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

情景:
数据列表中v-for 循环的 , 一些元素的显示隐藏依赖于数组中的字段 ,切判断的条件比较多,看着页面就不清爽 ,请问这些数据怎么处理,可以优化下呢?

image.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
4.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

1.template 标签中,用 slot-scope={row},可以代替 scope.row
2.后面三个按钮的判断条件,可以用一个逻辑来代替:

v-else-if="state >= 50 && (row.type == 1 || (row.type == 2 && hasJudicial == 1) || (row.type !== 2 && row.type !== 1 && row.hasChain))"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...