el-tag 出现这种情况的错误

Invalid prop: type check failed for prop "type". Expected String with value "danger", got Array

代码如下:

<el-table-column label="订单状态" align="center" prop="orderState" :formatter="orderStateFormat" width="100">
<template #default="scope">
<el-tag disable-transitions :type="[scope.row.orderState === 0? 'primary': scope.row.orderState === 1? 'warning': scope.row.orderState === 2? 'success': scope.row.orderState === 3? 'danger': scope.row.orderState === 4? 'info': scope.row.orderState === 5? 'info': scope.row.orderState === 6? 'info': '']" >{{ orderStateFormat(scope.row) }}
</el-tag>
</template>
</el-table-column>

还带有警告

解决办法是去掉中括号[]

<el-table-column label="订单状态" align="center" prop="orderState" :formatter="orderStateFormat" width="100">
<template #default="scope">
<el-tag disable-transitions :type="scope.row.orderState === 0? 'primary': scope.row.orderState === 1? 'warning': scope.row.orderState === 2? 'success': scope.row.orderState === 3? 'danger': scope.row.orderState === 4? 'info': scope.row.orderState === 5? 'info': scope.row.orderState === 6? 'info': ''" >{{ orderStateFormat(scope.row) }}
</el-tag>
</template>
</el-table-column>