element判断按钮的禁用条件
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element
免费下载资源
·
element通过条件判断按钮禁用
根据某个参数,动态的改变某个按钮的禁用状态
1.:disabled=“scope.row.userId==1?true:false”
根据登录的用户id判断选择的按钮是否禁用状态
实际应用场景:登录用户为系统管理员时只能修改密码
贴代码
<template slot-scope="scope">
<el-button @click.native.prevent="look(scope.row)" v-show="menuLook" type="success" size="mini">查看</el-button>
<el-button @click.native.prevent="edit(scope.row)" v-show="menuEdit" type="warning" size="mini" :disabled="scope.row.userId==1?true:false">编辑</el-button> <!--v-if="scope.row.userId=='1'" :disabled='disabled'-->
<el-button @click.native.prevent="del(scope.row)" v-show="menuRemove" type="danger" size="mini" :disabled="scope.row.userId==1?true:false">删除</el-button>
<el-button @click.native.prevent="stopUse(scope.row)" v-show="menuStop" type="info" v-if="scope.row.status==1" size="mini">启用</el-button>
<el-button @click.native.prevent="stopUse(scope.row)" v-show="menuStop" type="info" v-if="scope.row.status==0" size="mini" :disabled="scope.row.userId==1?true:false">停用</el-button>
<el-button @click.native.prevent="plResetPwdPage(scope.row)" v-show="menuResetPwd" type="warning" size="mini">重置密码</el-button>
</template>
GitHub 加速计划 / eleme / element
54.06 K
14.63 K
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:3 个月前 )
c345bb45
7 个月前
a07f3a59
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update table.md
* Update transition.md
* Update popover.md 7 个月前
更多推荐
已为社区贡献1条内容
所有评论(0)