vux 路由不跳转

作者: 初心_ae88 | 来源:发表于2019-01-10 10:00 被阅读0次

脚手架项目在main.js中定义了路由,需要把main.js中的路由配置删除,然后把自己写的路由文件(我的是index.js)重新引用一下。


之前的代码,划线的部分删除。

// The Vue build version to load with the `import` command

// (runtime-only or standalone) has been set in webpack.base.conf with an alias.

import Vuefrom 'vue'

import FastClick from 'fastclick'

import VueRouterfrom 'vue-router'

import Appfrom './App'

import Homefrom './pages/Home'

Vue.use(VueRouter)

const routes = [{

path:'/',

component: Home

}]

const router =new VueRouter({

routes

})

FastClick.attach(document.body)

Vue.config.productionTip =false

/* eslint-disable no-new */

new Vue({

router,

render: h => h(App)

}).$mount('#app-box')


改完之后的

// The Vue build version to load with the `import` command

// (runtime-only or standalone) has been set in webpack.base.conf with an alias.

import Vuefrom 'vue'

import FastClick from 'fastclick'

import VueRouterfrom 'vue-router'

import Appfrom './App'

import routerfrom './router'

Vue.use(VueRouter)

FastClick.attach(document.body)

Vue.config.productionTip =false

/* eslint-disable no-new */

new Vue({

router,

render: h => h(App)

}).$mount('#app-box')

相关文章

网友评论

    本文标题:vux 路由不跳转

    本文链接:https://www.haomeiwen.com/subject/khjbtqtx.html