-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Closed
Description
相关平台
H5
浏览器版本: 随意
使用框架: React
复现步骤
官方demo
添加h5自定义路由配置 比如
router: {
mode: "browser",
customRoutes: {
"pages/index/index": [
"/index",
"/home",
"/home-app",
"pages/index/index",
],
},
},访问 /home 与 /home-app 路径均无法获取到pageConfig, definePageConfig中配置不生效
期望结果
正常生效
实际结果
不生效
环境信息
Taro CLI 3.6.9 environment info:
System:
OS: macOS 14.5
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.19.0 - ~/.nvm/versions/node/v18.19.0/bin/node
Yarn: 1.22.22 - /opt/homebrew/bin/yarn
npm: 10.2.3 - ~/.nvm/versions/node/v18.19.0/bin/npm
npmPackages:
@tarojs/cli: 3.6.9 => 3.6.9
@tarojs/components: 3.6.9 => 3.6.9
@tarojs/helper: 3.6.9 => 3.6.9
@tarojs/plugin-framework-react: 3.6.9 => 3.6.9
@tarojs/plugin-platform-alipay: 3.6.9 => 3.6.9
@tarojs/plugin-platform-h5: 3.6.9 => 3.6.9
@tarojs/plugin-platform-jd: 3.6.9 => 3.6.9
@tarojs/plugin-platform-qq: 3.6.9 => 3.6.9
@tarojs/plugin-platform-swan: 3.6.9 => 3.6.9
@tarojs/plugin-platform-tt: 3.6.9 => 3.6.9
@tarojs/plugin-platform-weapp: 3.6.9 => 3.6.9
@tarojs/runtime: 3.6.9 => 3.6.9
@tarojs/shared: 3.6.9 => 3.6.9
@tarojs/taro: 3.6.9 => 3.6.9
@tarojs/taro-loader: 3.6.9 => 3.6.9
@tarojs/webpack5-runner: 3.6.9 => 3.6.9
babel-preset-taro: 3.6.9 => 3.6.9
eslint-config-taro: 3.6.9 => 3.6.9
补充信息
get pageConfig() {
const routePath = addLeadingSlash(stripBasename(this.pathname, this.basename));
const homePage = addLeadingSlash(this.homePage);
return this.routes.find((r)=>{
var _a;
const pagePath = addLeadingSlash(r.path);
return [
pagePath,
homePage
].includes(routePath) || ((_a = routesAlias.getConfig(pagePath)) === null || _a === void 0 ? void 0 : _a.includes(routePath));
});
}这里routesAlias.getConfig应该用routePath去查配置
Metadata
Metadata
Assignees
Labels
No labels