I'm a new with Vue. I'm having a small Vue app that load components dynamically. Each time I show a module, I load template, javascript of this module from server and run it. In the module I create a Vue component by Vue.component(). So if a component has been created before then what happens when I re-create it.
Will Vue cache it and doesn't re-create a new one or not cache it?
If Vue cache it then in the component's constructor, how do I know that component is showed!
Vue.component("component", {
template: '#component',
data: function() {
return {
items: [],
total: 0,
page: 1,
limit: 20
}
},
created() {
index.setExtensionCallback = function(params) {
list(params);
};
sendListRequest({requestParams: {p: 1, np: this.limit}});
},
methods: {
sendListRequest: function(params) {
var listingCmd = 21;
index.chanadmin.extensionRequest({cmd: listingCmd, requestParams: params.requestParams});
},
list: function(params) {
this.items = params.ar;
this.total = params.total;
}
}
});
Thanks!