vue通过ref改变input的type
template:<input type="text" ref="input"v-model="inputPad" @focus="zfocus" @blur="zblur">data:inputPad: "请输入支付密码",methods:zfocu
·
template:
<input type="text" ref="input" v-model="inputPad" @focus="zfocus" @blur="zblur">
data:
inputPad: "请输入支付密码",
methods:
zfocus() {
this.$refs.input.type = "password"
if (this.inputPad == "请输入支付密码") {
this.inputPad = ''
}
},
zblur() {
if (this.inputPad == '') {
this.inputPad = "请输入支付密码"
this.$refs.input.type = "text"
}
},
更多推荐
已为社区贡献16条内容
所有评论(0)