查漏补缺——说说ref和refs
问题
如题所示
答案
Vue里ref($refs)的用法
元素在ref属性进行注册,然后可以在Vue中使用this.$refs.name
操作该元素。
具体源码如下:
close(){
this.$refs.searchInput && this.$refs.searchInput.blur()
this.show = false
}