<el-col :lg="24" :xl="24"> <el-form-item v-if="isEdit" label="密码" prop="memberPassword" :label-width="formLabelWidth"> <el-input ref="passWord" v-model="organizationData.memberPassword" placeholder="请输入密码" :readonly="readonlyDis" autocomplete="new-password" show-password @focus="passFocus" @blur="passBlur" @input="passInput" /> </el-form-item> </el-col>
data() { readonlyDis: true } /** * 得到焦点 去掉只读属性 */ passFocus() { setTimeout(() => { this.readonlyDis = false }, 0) }, /** * 失去焦点 */ passBlur() { this.readonlyDis = true }, /** * 添加input事件测试事件的变化 */ passInput(val) { if (val === '') { this.passBlur() this.passFocus() } else { this.passFocus() } },