Vue rookie, is trying to do a SPA page, encountered a problem looked at a lot of information can not be solved, come here to ask for the opinions of your predecessors.
can vue-router get background data directly? How should it be done? If not, whether to get it through vue-resourse and then put it into vue-router?. If so, what should be done? Thank you very much!
the following is my code. I don"t know whether the idea for
background interface is"/ home", to try to get the information obtained by vue-resource from vue-router
var home = {
template:"<h3></h3>"
};
const router = new VueRouter({
routes:[
{path:"/home",component:home}
]
})
new Vue({
el:"-sharpapp",
router,
dataGroup:[],
methods:{
renderArticle(url){
this.$http.get(url,{
}).then((res)=>{
this.dataGroup = res.data;
},(res)=>{
alert(res.status)
})
}
},
created(){
this.renderArticle("/home")
}
})