沐若清辰
人生如茶,浓也好,淡也好,各有味道
<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()
      }
    },
posted on 2022-03-17 11:32  沐若清辰  阅读(109)  评论(0编辑  收藏  举报