使用vue路由js文件如下import Vue from 'vue'import VueRouter from 'vue-router'import Daohangafter from './vue/daohangafter.vue'new Vue({ el:'#five', template:'<div><h1>数据获取</h1><hr/><Daohangafter></Daohangafter></div>', components:{ Daohangafter }})vue文件如下<template><div><h2>导航完成后过去数据</h2><div><router-link to="/shuju/one">/shuju/one</router-link><router-link to="/shuju/two">/shuju/two</router-link><router-link to="/shuju/three">/shuju/three</router-link></div><div v-if="loading">Loading...</div><router-view></router-view></div></template><script>import Vue from 'vue'import VueRouter from 'vue-router'Vue.use(VueRouter)const Pagepages={ template:'<div>fkafnbkfapdp</div>'}const router=new VueRouter({ mode:'history', base:__dirname, routes:[ { path:'/shuju/:id', name:'shuju', component:Pagepages } ]})export default{ name:'daohangafter', data(){ return{ loading:false, post:null } }}</script>在浏览器查看效果发现报错请问是为什么报错,哪里出现问题呢?如何改正呢?
1 回答
慕容森
TA贡献1853条经验 获得超18个赞
export default {
name: 'daohangafter',
data() {
return {
loading: false,
post: null
}
},
router
}
添加回答
举报
0/150
提交
取消