Home  >  Article  >  Web Front-end  >  Redirects for Vue.js routing

Redirects for Vue.js routing

php中世界最好的语言
php中世界最好的语言Original
2018-03-13 14:44:362363browse

This time I will bring you the redirection of Vue.js routing. What are the precautions for using Vue.js routing redirection? The following is a practical case, let’s take a look.

redirect
Set when initializing routing

let router = new VRouter({ // 如果mode设为history, 那么地址就可以不使用哈希(# 哈希)了,就可以直接访问. http://localhost:8080/#/apple ==>> http://localhost:8080/apple
  mode: 'history',  routes: [
    {      //当路径为'/'时,重新跳转到apple
      path: '/',      //设置重定向
      redirect: '/apple'
    },
    {      path: '/apple',
      ......
    },
    {      path: '/banana',
      ......
    }
  ]
})

Redirects for Vue.js routing


I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to the php Chinese website Other related articles!

Recommended reading:

The unit component of Vue.js

How to set routing in Vue.js

The above is the detailed content of Redirects for Vue.js routing. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn