javascript - display different content based on different data
代言
代言 2017-07-05 10:59:11
0
2
1092


My planCount is not fixed, how should I write it, for example

planCount==1; Display level one
planCount==2; Display level two
planCount==3; Display level three

代言
代言

reply all(2)
滿天的星座
{this.props.data.planCount === 1 ? "一级" : (this.props.data.planCount === 2 ? "二级" : "三级")}
为情所困
<td className="width-w-10">{this.props.data.planCount}级</td>

If you want to convert the numbers into Chinese, additional processing is required. If it does not exceed 10, you can do this

const level = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十']
<td className="width-w-10">{level[this.props.data.planCount - 1]}级</td>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!