验证码: 看不清楚,换一张 查询 注册会员,免验证
  • {{ basic.site_slogan }}
  • 打开微信扫一扫,
    您还可以在这里找到我们哟

    关注我们

Vue中的@blur/@focus事件怎么使用

阅读:756 来源:乙速云 作者:代码code

Vue中的@blur/@focus事件怎么使用

Vue的@blur/@focus事件

  • @blur 是当元素失去焦点时所触发的事件

  • @focus是元素获取焦点时所触发的事件

 
 

 

 

focus和blur事件,改变选中时搜索框的背景色

template


    
    

js

changBackground (flag) {

  switch (flag) {
    case 1:
      console.log('获取焦距')
      this.$refs.searchBoxOfChatRoom.style.background = 'white'
      this.$refs.searchOfChatRoom.style.background = 'white'
      break
    case 2:
      console.log('失去焦距')
      this.$refs.searchBoxOfChatRoom.style.background = '#dadada'
      this.$refs.searchOfChatRoom.style.background = '#dadada'
      break
    default:
      break
  }
}
分享到:
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: hlamps#outlook.com (#换成@)。
相关文章
{{ v.title }}
{{ v.description||(cleanHtml(v.content)).substr(0,100)+'···' }}
你可能感兴趣
推荐阅读 更多>