您现在的位置是:首页 >学无止境 >elementplus+vue实现选择不同的状态同时切换颜色网站首页学无止境
elementplus+vue实现选择不同的状态同时切换颜色
简介elementplus+vue实现选择不同的状态同时切换颜色
elementplus+vue实现选择不同的状态同时切换颜色
函数
statusText(status) {
const statusMap = {
active: '激活',
inactive: '禁用',
executing: '执行中',
paused: '暂停',
stopped: '停止'
};
return statusMap[status] || status;
},
statusColor(status) {
const colorMap = {
active: 'green',
inactive: 'red',
executing: 'blue',
paused: 'orange',
stopped: 'gray'
};
return colorMap[status] || 'black';
}
template中的element组件代码
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<span :style="{ color: statusColor(scope.row.status) }">
{{ statusText(scope.row.status) }}
</span>
</template>
</el-table-column>
风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。





U8W/U8W-Mini使用与常见问题解决
QT多线程的5种用法,通过使用线程解决UI主界面的耗时操作代码,防止界面卡死。...
stm32使用HAL库配置串口中断收发数据(保姆级教程)
分享几个国内免费的ChatGPT镜像网址(亲测有效)
Allegro16.6差分等长设置及走线总结