请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

Where should I write Router.push("/good")?

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 filehttps://img1.sycdn.imooc.com/szimg//5919c92700013eef07300700.jpg

正在回答

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    

}];    

0 回复 有任何疑惑可以回复我~
  • 提问者 weibo_Gingbery_0 #1
    Thanks
    回复 有任何疑惑可以回复我~ 2017-05-16 09:11:58
  • 提问者 weibo_Gingbery_0 #2
    I got another problem.I configured the router in this way and when the "tab-item"was clicked and activated,they just wouldn't be added  "link-active-class" automatically. I've searched possible causes and got nothing....
    回复 有任何疑惑可以回复我~ 2017-05-16 14:42:48
ustbhuangyi 2017-05-16 22:50:24

try '/goods' and  the template is:  <router-link to="/goods">商品</router-link>

0 回复 有任何疑惑可以回复我~
提问者 weibo_Gingbery_0 2017-05-16 09:14:23

I've solved this prolem by 

export default new Router({
  routes: [
    {
      path: '/',
      redirect:{name:'goods'}
    },


0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信