默认打包访问路由
https://{
{domain}}/#/pages/index/index
期望打包访问路由
https://{
{domain}}/pages/index/index
解决文档
taro 路由相关的配置 h5.router
配置路由模式
配置路由模式。‘hash’ 与 ‘browser’ 分别对应 hash 路由模式和浏览器 history 路由模式。默认值:‘hash’。
实例
修改项目 config/index.js
module.exports = {
// ...
h5: {
// ...
router: {
mode: 'browser' // 或者是 'hash'
}
}
}
针对上面的配置