定义路由文件 /src/router/index.js
import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
Vue.use(VueRouter)
const router = new VueRouter({
mode: 'history',
routes
})
export default router
在vuex store中引入router
import router from '@/router';
在vuex 操作中通过下面去获取id值
router.currentRoute.params.id