use vue to route
js files as follows
import Vue from "vue"
import VueRouter from "vue-router"
import Daohangafter from "./vue/daohangafter.vue"
new Vue({
el:"-sharpfive",
template:"<div><h1></h1><hr/><Daohangafter></Daohangafter></div>",
components:{
Daohangafter
}
})
the vue file is as follows
<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>
check the effect in the browser and find an error
Why is the error reported and where is the problem? How to correct it?