Home > Web Front-end > JS Tutorial > body text

Redirects for Vue.js routing

php中世界最好的语言
Release: 2018-03-13 14:44:36
Original
2378 people have browsed it

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',
      ......
    }
  ]
})
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template