请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

正在回答 回答被采纳积分+3

1回答

Dell 2020-09-06 23:24:53

import VueRouter from 'vue-router'

0 回复 有任何疑惑可以回复我~
  • 提问者 慕慕4402846 #1
    试过了一样的,
    import Vue from 'vue'
    import Router from 'vue-router'
    
    Vue.use(Router)
    export default new Router({
      routes: [    
        {path:'/',name:"Home",component:()=>import('../views/Home.vue')},
        {path:'/city',name:"list",component:()=>import('../city/City.vue')},
        {path:'/detail/:id',name:"detail",component:()=>import('../components/detail/detail.vue')},
      ],
      mode:"history",
      base:process.env.BASE_URL,
      scrollBehavior (to, from, savedPosition) {
            if (savedPosition) {
              return savedPosition
            } else {
              return {
                x: 0,
                y: 0
              }
            }
      }
    })
    回复 有任何疑惑可以回复我~ 2020-09-06 23:28:00
  • Dell 回复 提问者 慕慕4402846 #2
    import { createApp } from 'vue'
    import App from './App.vue'
    import router from './router'
    import store from './store'
    import 'normalize.css'
    import './style/index.scss'
    
    createApp(App).use(router).use(store).mount('#app')
    参考这个语法呢?
    回复 有任何疑惑可以回复我~ 2020-09-12 22:20:39
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信