使用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>
在浏览器查看效果发现报错
请问是为什么报错,哪里出现问题呢?如何改正呢?
慕容森
相关分类