如何删除哈希爆炸#!
来自网址?
我在 vue 路由器文档中找到了禁用 hashbang 的选项(http://vuejs.github.io/vue-router/en/options.html http://vuejs.github.io/vue-router/en/options.html)但是这个选项删除了#!
然后把#
有没有办法获得干净的网址?
Example:
NOT: #!/home
BUT: /home
Thanks!
In Vue 3,你想使用createWebHistory
为了history
option.
import { createRouter, createWebHistory } from 'vue-router'
const router = createRouter({
history: createWebHistory(),
// ...
})
In Vue 2,你想要设置mode
to 'history'
.
const router = new VueRouter({
mode: 'history',
// ...
})
不过,请确保您的服务器配置为处理这些链接。https://router.vuejs.org/guide/essentials/history-mode.html https://router.vuejs.org/guide/essentials/history-mode.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)