I mounted an element to the element when I clicked it, but as soon as I loaded the page, it was triggered manually, causing an instance to be mounted to the element. Then I click on the element which causes it to be mounted repeatedly. How do I cancel the last mount? (I know this method is not very reasonable, but it has been done like this now)
The project is a bit big
Let me give you a rough idea
$(a).click(function(){
var vue=new Vue({
el:"挂钩的元素",
data:{},
methods:{}
})
}
$(document).ready(function(){
$(a).trigger('click');
});
When the page is loaded, an element is hooked, and then when element a is clicked, element a will be hooked again
大家讲道理2017-06-26 10:53:57
Your description is difficult for everyone to understand. It is really difficult to answer without posting the code.
Based on your literal meaning, I suggest you set a bool variable, control it with v-if, and then change the value of the variable by clicking.