Home Web Front-end JS Tutorial Vue.js route naming and named views

Vue.js route naming and named views

Mar 13, 2018 pm 02:43 PM
javascript vue.js view

This time I will bring you the routingnaming and namingview of Vue.js, what are the notes of Vue.js routing naming and naming the view? , the following is a practical case, let’s take a look.

Route naming We can set a name attribute when setting the route, during the navigation process directly: to="{name: 'corresponding name'} "You can

let router = new VRouter({  mode: 'history',  routes: [
    {      path: '/apple',      component: Apple,      //命名路由
      name: 'applePage',
    }
   ......
  ]
})
Copy after login

When used in other places outside:

<router-link :to="{name: 'applePage'}" >to apple</router-link>
Copy after login

Named view
is similar to the named route above, add the specified name to the component

let router = new VRouter({  mode: 'history',  routes: [
    {      path: '/apple',      //命名视图
      component: {        viewA: Apple,        viewB: RedApple
      },      //命名路由
      name: 'applePage',
    }
   ......
  ]
})
Copy after login

When used in other places outside:

<router-view name="viewA"></router-view>或者<router-view name="viewB"></router-view>分别插入不同的视图
Copy after login

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:

Other operations of Vue.js routing

Vue.js single component component

The above is the detailed content of Vue.js route naming and named views. For more information, please follow other related articles on the PHP Chinese website!

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to implement an online speech recognition system using WebSocket and JavaScript How to implement an online speech recognition system using WebSocket and JavaScript Dec 17, 2023 pm 02:54 PM

How to implement an online speech recognition system using WebSocket and JavaScript

Understand the differences and comparisons between SpringBoot and SpringMVC Understand the differences and comparisons between SpringBoot and SpringMVC Dec 29, 2023 am 09:20 AM

Understand the differences and comparisons between SpringBoot and SpringMVC

WebSocket and JavaScript: key technologies for implementing real-time monitoring systems WebSocket and JavaScript: key technologies for implementing real-time monitoring systems Dec 17, 2023 pm 05:30 PM

WebSocket and JavaScript: key technologies for implementing real-time monitoring systems

How to implement an online reservation system using WebSocket and JavaScript How to implement an online reservation system using WebSocket and JavaScript Dec 17, 2023 am 09:39 AM

How to implement an online reservation system using WebSocket and JavaScript

How to use JavaScript and WebSocket to implement a real-time online ordering system How to use JavaScript and WebSocket to implement a real-time online ordering system Dec 17, 2023 pm 12:09 PM

How to use JavaScript and WebSocket to implement a real-time online ordering system

JavaScript and WebSocket: Building an efficient real-time weather forecasting system JavaScript and WebSocket: Building an efficient real-time weather forecasting system Dec 17, 2023 pm 05:13 PM

JavaScript and WebSocket: Building an efficient real-time weather forecasting system

Simple JavaScript Tutorial: How to Get HTTP Status Code Simple JavaScript Tutorial: How to Get HTTP Status Code Jan 05, 2024 pm 06:08 PM

Simple JavaScript Tutorial: How to Get HTTP Status Code

What are the views in Word? What are the views in Word? Mar 19, 2024 pm 06:10 PM

What are the views in Word?

See all articles