Where should I write Router.push("/good")?
来源:15-5 Vue-router(下)
weibo_Gingbery_0
2017-05-15
I put the router file in "src/router/index.js",and where should I write Router.push("/good")?I have tried writed it in index.js or main.js,neither did it work....below is the router file
写回答
3回答
-
use redirect instead, here is the code:
const routes = [{
path: '/',
redirect: '/goods'
}, {
path: '/goods',
component: goods
}, {
path: '/ratings',
component: ratings
}, {
path: '/seller',
component: seller
}];
022017-05-16 -
ustbhuangyi
2017-05-16
try '/goods' and the template is: <router-link to="/goods">商品</router-link>
00 -
weibo_Gingbery_0
提问者
2017-05-16
I've solved this prolem by
export default new Router({ routes: [ { path: '/', redirect:{name:'goods'} },00
相似问题