vue里的按钮根据接口返回的数据显示不同等级

          <template slot-scope="scope">
            <!-- <el-button   @click="level(scope.row)">查看每行数据</el-button> -->
            <!-- 模仿接口拿到的数据  0 一级 1二级  都不是则为3级 -->
            <el-tag v-if="scope.row.level === '0'">一级</el-tag>
            <el-tag type="success" v-else-if="scope.row.level === '1'">二级</el-tag>
            <el-tag type="warning" v-else>三级</el-tag>
          </template>

level是接口里的名称 如namse

猜你喜欢

转载自blog.csdn.net/weixin_57607714/article/details/124883882