扫码关注官方订阅号
我的planCount,是不固定的,我应该怎样写比如
planCount==1; 显示 一级planCount==2; 显示 二级planCount==3; 显示 三级
{this.props.data.planCount === 1 ? "一级" : (this.props.data.planCount === 2 ? "二级" : "三级")}
<td className="width-w-10">{this.props.data.planCount}级</td>
如果要将数字转化成中文就需要额外处理了 不超过10的话可以这样
const level = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十'] <td className="width-w-10">{level[this.props.data.planCount - 1]}级</td>
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
如果要将数字转化成中文就需要额外处理了 不超过10的话可以这样