简体   繁体   English

我想在 vuejs 中获取 div 元素代码,例如带有事件函数的子元素

[英]i want to get div element code like childs with event functions in vuejs

in my project my new requirement is we can create a page with custom buttons in one page with different screen position and optional to add and no.of same buttons to add and we can use event functions in another page like docuSign project在我的项目中,我的新要求是我们可以在具有不同屏幕 position 的页面中创建一个带有自定义按钮的页面,并且可以选择添加和添加相同按钮的数量,我们可以在另一个页面中使用事件功能,例如 docuSign 项目

i would like to get element childs with event functions in vujs我想在 vujs 中获得具有事件函数的元素子元素

In vue you can access (idiomatically) elements using the $refs property.在 vue 中,您可以使用$refs属性访问(惯用的)元素。 You would put on an element ref="myEl" and then in your code you can grab the element on some event like so:您将放置一个元素ref="myEl" ,然后在您的代码中您可以在某些事件中获取该元素,如下所示:

this.$refs.myEl.el.<do something>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM