element的 el-switch 标签里怎么写三元表达式?

我想当scope.row.on==='某个值' 的时候el-switch标签里才有disabled属性,该怎么加?

    <el-table-column width="200%" label="状态" class="switchVal">
        <template slot-scope="scope">
          <el-switch
            @change="changeSwitch(scope.$index, scope.row)"
            v-model="scope.row.on"
            disabled
            active-text="启用"
            inactive-text="">
            on-color="#00A854"
            on-text="启动"
            on-value="1"
            off-color="#F04134"
            off-text="禁止"
            off-value="0"
            >
          </el-switch>
        </template>
      </el-table-column>
阅读 5.3k
2 个回答

这其实和Element没啥关系,Vue的绑定

你的问题,解决方案如下:示例

:disabled="scope.row.on==='某个值'"

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题