javascript - vue el mounts the same instance repeatedly
欧阳克
欧阳克 2017-06-26 10:51:57
0
1
797

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

欧阳克
欧阳克

温故而知新,可以为师矣。 博客:www.ouyangke.com

reply all (1)
大家讲道理

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.

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!