vue项目中如何利用v-on:blur监听失焦事件,下面web建站小编给大家简单介绍一下!
具体语法如下:
<template>
<div>
<label for="username">用户名:</label>
<input type="text" id="username" v-model="username" @blur="checkUsername">
<div v-show="showErrorMsg">{{errorMsg}}</div>
</div>
</template>
<script>
export default {
data() {
return {
username: '',
showErrorMsg: false,
errorMsg: ''
}
},
methods: {
checkUsername() {
// 这里我们简单判断用户名是否为空
if (this.username === '') {
this.showErrorMsg = true
this.errorMsg = '用户名不能为空'
} else {
this.showErrorMsg = false
}
}
}
}
</script>
上面是“vue中如何利用v-on:blur监听失焦事件”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_4879.html
workflows工作流
一只处于战斗状态下的蚂蚁ComfyUI工作流
一座精致透明的白瓷人物雕塑comfyui工作流
一块慕斯蛋糕ComfyUI工作流
五颜六色的球花comfyui工作流
文生图工作流:树枝上站着一只鸟
一个超现实和超现实的场景,在森林中心有一座蛇形的房子
汉堡里的一只毛茸茸的小猫ComfyUI工作流
一位穿着长袍的强大法师ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

3d文字360度旋转
利用html5+css3实现滚雪球效果(附代码)
利用canvas画几个好玩的星云物种
3D立体人物效果
利用js+css3做一个小鱼游泳特效
css3+js菜单点击动态效果
css3画弹珠,可以滚动!
自动打字效果(惊喜在后面)







