纵有疾风起
人生不言弃

(转载)vue路径后面去除#号

介绍: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路径后面去除#号
分享到: 生成海报

评论 抢沙发

评论前必须登录!

立即登录