vue 路由器链接上的磅符号

Dra*_*ier 3 vue.js

嗨,我如何在 vue.js 中删除路由器链接中的井号?我总是在每个链接中得到一个英镑符号,例如:http://localhost:8080/#/

export default new Router({
  routes: [
    {
      path: '/',
      name: 'SplashScreen',
      component: SplashScreen
    },
    {
      path: '/aboutus',
      name: 'AboutUs',
      component: AboutUs
    },
    {
      path: '/aboutus',
      name: 'Dashboard',
      component: Dashboard
    }
  ]
})
Run Code Online (Sandbox Code Playgroud)

Nik*_*aut 9

使用模式作为 history

 const router = new VueRouter({
   mode: 'history',
   routes: [...]
 })
Run Code Online (Sandbox Code Playgroud)

还需要服务器配置 Apache

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.html [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)

在此处查看更多详细信息