我想在vue中获取调用html元素.js通过jQuery对其进行修改.现在,我给每个元素指定类名+索引,然后通过jQuery调用它,但这看起来像是一个疯狂的攻击.
我想做的是:
new Vue({
el: "#app",
data: {
testFunction : function(element) {
$(element).doSomethingWithIt(); //do something with the calling element
}
}
});
这是调用元素:
<div v-on:click="testFunction(???)">Test</div>
我可以向函数中传递什么来获取div元素,或者是否有其他方法来实现这一点?