亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

router.push not working - Stack Overflow
高洛峰
高洛峰 2017-06-26 10:53:18
0
3
854

import Vue from 'vue'
import App from './App'
import VueRouter from './router'

Vue.config.productionTip = false

VueRouter.push('/goods')

/ eslint-disable no-new /
new Vue({
el: '#app',
router: VueRouter,
template: '<App />',
components: { App }
})

Here VueRouter.push('/goods') is valid

import Vue from 'vue'
import Router from 'vue-router'
import goods from '../components/goods/goods'
import seller from '../components/seller/ seller'
import ratings from '../components/ratings/ratings'

Vue.use(Router)

/ eslint-disable no-new /
const routes = [
{ path: '/seller', component: seller },
{ path: '/ratings' , component: ratings },
{ path: '/goods', component: goods }
]

Router.push('/goods')

export default new Router({
routes
})

The .push here is invalid
I don’t quite understand the problem here

高洛峰
高洛峰

擁有18年軟件開發(fā)和IT教學(xué)經(jīng)驗。曾任多家上市公司技術(shù)總監(jiān)、架構(gòu)師、項目經(jīng)理、高級軟件工程師等職務(wù)。 網(wǎng)絡(luò)人氣名人講師,...

reply all(3)
phpcn_u1582

Change the one below to routes.push

僅有的幸福

Change the one below to routes.push({path:'/goods'})

Peter_Zhu

Router.push('/goods') can only be called after the route is successfully configured and referenced in the required page. The question is: your route outputs routes, so you must import routes where you need to use them, that is, import routes from '/routing configuration file'. Finally, you can use the relevant api in the page after the routes are introduced

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