Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

我在组件中ref属性获取Dom节点采用kebab-case方式命名,在js获取vue实例的$refs对应的属性是用驼峰的方式获取为什么是undefined,$refs中明明有这个属性。
图片描述

图片描述

图片描述


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
344 views
Welcome To Ask or Share your Answers For Others

1 Answer

ref 的 key 和你填的key是一样的, 不会自动转换成驼峰式,如果你要用驼峰式 直接用ref="camelCase" 就可以了


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...