报Uncaught TypeError: Cannot read property 'city' of undefined错误
来源:11-3 首页代码迁移及代理配置变更
dream_jason
2020-11-19
index.js代码如下:
import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/pages/home/Home'
// import City from '@/pages/city/City'
// import Detail from '@/pages/detail/Detail'
Vue.use(Router)
export default new Router({
routes: [{
path: '/',
name: 'Home',
component: Home
},
//{
// path: '/city',
// name: 'City',
// component: City
// }, {
// path: '/detail/:id',
// name: 'Detail',
// component: Detail
//}
],
scrollBehavior(to, from, savedPosition) {
return { x: 0, y: 0 }
}
})
main.js代码如下:
import Vue from 'vue'
import App from './App'
import router from './router'
import VueAwesomeSwiper from 'vue-awesome-swiper'
import store from './store'
import 'styles/reset.css'
import 'styles/border.css'
import 'styles/iconfont.css'
import 'swiper/dist/css/swiper.css'
Vue.config.productionTip = false
Vue.use(VueAwesomeSwiper, /* { default options with global component } */ )
//new
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
写回答
1回答
-
Dell
2020-11-21
import Router from 'vue-router' ,你应该是用的 vue-router 版本 不对,你看看你现在版本号是多少
00
相似问题