I want to create new html element with v-on
call. However after I call function pasted below the v-on is not rendered so nothing happens after click. Is there anyway I can force vue to re-render this element?
createFromTemplate: function() {
var el = document.body.appendChild(document.createElement('div'));
el.innerHTML = '<a href="#" v-on="click: close()"></a>;
},
The same thing that you do to populate the element:
el.innerHTML = '<a href="#" v-on="click: close()"></a>;
can be done to assign a function:
el.onclick = function() {
//do stuff
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.