javascript - How to add a new page after vue-cli is built
黄舟
黄舟 2017-05-16 13:43:56
0
2
543

I just built the structure of vue-cli

This page has come out. If I want to continue to add several components, how should I edit it? I have no idea. I’m not very familiar with router yet, please give me some advice

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(2)
洪涛

Use vue-router to configure routing and inject it in the vue root instance

import Vue from 'vue'
import VueRouter from 'vue-router'

import topNav from '../components/topNav'
import mine from '../components/mine'
import searchPage from '../components/searchPage'
import searchResult from '../components/searchResult'
import playPage from '../components/playPage'
import playbottom from '../components/playbottom'
import latestPlay from '../components/latestPlay'

Vue.use(VueRouter)

const router = new VueRouter({
    routes: [
        {
            path: '/',
            component: mine
        },
        {
            path: '/mine',
            component: mine
        },
        {
            path: '/mine/searchPage',
            component: searchPage
        },
        {
            path: '/mine/searchPage/searchResult',
            component: searchResult
        },
        {
            path: '/playPage',
            component: playPage
        },
        {
            path: '/latestPlay',
            component: latestPlay
        }


    ]
})
export default router
import router from '../router'
var app = new Vue({
    el: "#app1",
    router,
    store: vuex_store,
})

That’s about it. Use <router-link to="/play"></router-link> for the link.
It is recommended to learn from the documentation

滿天的星座

http://router.vuejs.org/zh-cn...
Reference documentation. .
Configure routing

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template