时间: 2020-11-26|53次围观|0 条评论

介绍:vue项目中 打开页面后 后面路径带#号 例如 http://192.168.1.187:8082/#/rejectionManagement

面试的时候 很多面试官都会问 路径后面的#如何去除 其实很简单 只需要一个属性 mode:''history''

 

import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import city from '@/components/city'
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component: HelloWorld
    },
    {
      path:'/city',
      name:'city',
      component:city
    }
  ],
  mode:'history'   //去除#号
})

 

转载于:https://www.cnblogs.com/shenxinpeter/p/11114115.html

原文链接:https://blog.csdn.net/weixin_30342827/article/details/98665171

本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。

本博客所有文章如无特别注明均为原创。
复制或转载请以超链接形式注明转自起风了,原文地址《(转载)vue路径后面去除#号
   

还没有人抢沙发呢~