Given I have a component called upload-csv
Vue.component('upload-csv',{
props:['clientnames'],
template:`
<ul>
<li v-for="clientname in clientnames">{{ clientname.name }}</li>
</ul>
`
});
Then a Vue Instance
new Vue({
el:"#upload-csv-component",
data:{
loadurl:'http://localhost/startup/public/index.php/loadnames',
clientnames:[]
},
mounted:function(){
axios.get(this.loadurl)
.then(function(response){
this.clientnames = response.data;
})
.catch(function(error){});
}
});
Wish to use it this way
<div id="upload-csv-component">
<upload-csv :clientnames="clientnames"></upload-csv>
</div>
But the list is not rendering; I have changed mounted hook to beforeMount yet the list is not rendering.
Please can someone suggest a way to solve this problem.