jsx 语法三原表达式写 行内类名、行内样式

className={`titleBox ${index == 2 ? 'leftFloat' : ''}`}

 

<div className={text < 50 ? 'redText' : 'greenText'}>{text}%</div>

 

<span
          className="lineColor"
          style={{ color: text === '已解决' ? '#00FFB1' : '#FF672A' }}
        >

 

style={{ background: `url(${bg}) no-repeat` }}

 

style={{
              backgroundImage: `url(${
                index == 0
                  ? firstCircle
                  : index == 1
                  ? secondCircle
                  : index == 2
                  ? threeCircle
                  : normalCircle
              })`,
            }}

 

style={{
              background: `url(${
                index == 0
                  ? firstCircle
                  : index == 1
                  ? secondCircle
                  : index == 2
                  ? threeCircle
                  : normalCircle
              }) no-repeat center`,
            }}

 

 style={{
          backgroundImage: `url(${top ? redItemBtg : blueItemBtg})`,
          width: `${top ? '237px' : ''}`,
          height: `${top ? '230px' : ''}`,
        }}

 

posted @ 2022-07-27 12:57  SimoonJia  阅读(241)  评论(0编辑  收藏  举报