An example analysis of how Vue.js operates multiple routing areas on a single page

黄舟
Release: 2017-07-17 12:00:34
Original
2170 people have browsed it

This article mainly introduces Vue.js single page multipleroutingRelated information about detailed examples of regional operations. Friends in need can refer to

Single page multiple routing regional operations

If there are two or more areas in a page, you need to set the index.js of the route to operate the contents of these areas

App.vue Settings in index.js:

  
Copy after login

Settings in index.js:

import Vue from 'vue' import Router from 'vue-router' import Hello from '@/components/Hello' import First1 from '@/components/first1' import First2 from '@/components/first2' Vue.use(Router) export default new Router ({ routes : [ { path : '/', name : 'Hello', components : { default : Hello, left : First1, right : First2 } } ] })
Copy after login

The following settings are to exchange the two components for display when the url is /#/first location

export default new Router ({ routes : [ { path : '/', name : 'Hello', components : { default : Hello, left : First1, right : First2 } }, { path : '/first', name : 'First', components : { default : Hello, left : First2, right : First1 } } ] })
Copy after login

The above is the detailed content of An example analysis of how Vue.js operates multiple routing areas on a single page. 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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!