Ternary operator, multi-conditional judgment

In the above conditional expression, the third part of expression is a conditional expression. According to the associativity of the conditional expression, the above conditional expression is equivalent to:

quote

 

x>0?1:(x<0?-1:0)

Judging three states in vue elementui

<template slot-scope="scope">
<el-tag :type="scope.row.auditStatus === '已通过' ? 'primary' :(scope.row.auditStatus === '待审核'?'success':'danger')" disable-transitions>{{scope.row.auditStatus}}</el-tag>
</template>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325163355&siteId=291194637