其他的思路应该差不多,请自行修改
// :readonly='readonly' 先让input改成只读
// @focus='handlerIptClick' 聚焦触发函数
<el-form-item prop="username">
<el-input @focus='handlerIptClick' :readonly='readonly' autocomplete='off'></el-input>
</el-form-item>
<el-form-item prop="password">
<el-input @focus='handlerIptClick' :readonly='readonly' type="password" autocomplete='off'></el-input>
</el-form-item>
data () {
return {
readonly: true
}
}
// 触发函数取消只读状态
handlerIptClick () {
this.readonly = false
},