const router = new VueRouter({
routes: [
{
path: '/', //设置默认路由为Top250
component: charts
},
{
path: '/charts', //Top250
component: charts
},
{
path: '/hot',
component: hot
},
{
path: '/ing',
component: ing
},
{
path: '/newmovie',
component: newmovie
},
]
}
{
path: '/charts/:id', //子路由
component: charts,
children: [
{path: '1', component: moviecontent},
{path: '2', component: moviecontent2},
{path: '3', component: moviecontent3}
]
}
<router-link to="/charts/1">1</router-link> <router-link to="/charts/2">2</router-link> <router-link to="/charts/3">3</router-link>
<router-view></router-view>
{
path: '/charts/:id', //子路由
component: charts,
children: [
{path: '1', component: moviecontent2}, // 同一组件
{path: '2', component: moviecontent2}, // 同一组件
{path: '3', component: moviecontent2} // 同一组件
]
}
created: function () {
//第一次进入路由时数据的更新
this.$http.jsonp()
},
watch: {
'$route': 'getData' //切换路由,调用getData方法
},
methods: {
getData: function () {
//路由切换,重新请求数据
this.$http.jsonp()
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-3 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2026 源码网商城 (www.yuanmawang.com) 版权所有