vue中去掉url地址栏中的#符号

要去掉vue中访问地址中的#符号可以在路由器中设置路由模式为history:

export default new Router({
  mode:'history',
  routes: [
    {
      path: '/',
      name: 'Home',
      component: Home
    },
	{
      path: '/news',
      name: 'News',
      component: News
    },
	{
      path: '/goods',
      name: 'Goods',
      component: Goods
    },
	{
      path: '/detail/:id',
      name: 'Detail',
      component: Detail
    }
  ]
})

  效果如下:

 

转载于:https://www.cnblogs.com/wntd/p/9104694.html

你可能感兴趣的:(javascript,前端)