金狮镖局 Design By www.egabc.com
假设有需求:
后台返回状态1:启用,0:禁用
1、若要使启用为绿色,禁用不添加其他样式
<el-table-column prop="statusName" align="center" label="状态"> <template slot-scope="scope"> <div :class="{active:scope.row.status==1}"> {{ scope.row.statusName }} </div> </template> </el-table-column> .active{ color:green; }
1、若要使启用为绿色,禁用为红色,可使用三元表达式绑定样式
<el-table-column prop="statusName" align="center" label="状态"> <template slot-scope="scope"> <div :class="scope.row.status==1"> {{ scope.row.statusName }} </div> </template> </el-table-column> .active{ color:green; } .native{ color:red; }
补充知识:vue通过判断写样式(v-bind)
如下所示:
v-bind:style="$index % 2 > 0"
以上这篇Vue 样式切换及三元判断样式关联操作就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
金狮镖局 Design By www.egabc.com
金狮镖局
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
金狮镖局 Design By www.egabc.com
暂无Vue 样式切换及三元判断样式关联操作的评论...
更新日志
2024年09月23日
2024年09月23日
- 华少翌.2005-华少翌【中唱艺能】【WAV+CUE】
- 群星《十二女声Ⅱ》[WAV/CUE/分轨][527MB]
- 大自然音乐系列《漫步在山裡》[WAV/CUE/分轨][502.8MB]
- 大自然音乐系列《星光夜语》[WAV/CUE/分轨][453.3MB]
- 史依弘《史依弘交响乐京剧演唱专辑HQ》头版限量编号[WAV+CUE]
- 曼丽2020《女人三十风继续吹》HQCD[WAV+CUE]
- 曼丽2021《女人三十2雾之恋》HQCD[WAV+CUE]
- 隔壁老樊.2019-我曾【好听音乐】【FLAC分轨】
- 高林生.1993-牵挂你的人是我【白天鹅】【WAV+CUE】
- 洪卓立.2012-找个懂我的女孩(国专)【英皇娱乐】【WAV+CUE】
- 曼丽2022《女人三十3晚秋》HQCD[WAV+CUE]
- 曼丽2018《女人三十4冬天》HQCD[WAV+CUE]
- 柏菲-《好歌30年壹》限量开盘母带ORMCD[低速原抓WAV+CUE]
- 大自然音乐系列《水舞》[WAV/CUE/分轨][424.3MB]
- 大自然音乐系列《星光夜语》[WAV/CUE/分轨][453.3MB]