Vue 404页面与链接不加#号

import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import params from '@/components/params'
import Hi1 from '@/components/Hi1'
import Error from '@/components/Error'



Vue.use(Router)

export default new Router({
  //路径不加#号
  mode:'history',
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component:HelloWorld
    },{
      path:'/params/:newsId/:newsTitle',
      component:params
    },{
      path:'/goHome',
      redirect:'/'
    },{
      path:'/goParams/:newsId/:newsTitle',
      redirect:'/Params/:newsId/:newsTitle'
    },{
      path:'/hi1',
      component:Hi1,
      alias:'/jspang'
    }
    //当输入错误显示404
    ,{
      path:'*',
      component:Error
    }
  ]
})

 

你可能感兴趣的:(Vue)