Open Elon-Ling opened 4 years ago
页面A引入 taro-f2 的 F2Canvas 后,使用 Taro.navigateTo 无法跳转到页面B。 不过浏览器地址变了,并且只会变为hash模式的地址,无法变为browser模式的地址(config/index.js配置了h5 router mode 是 browser)。
import { F2Canvas } from "taro-f2"; // xxxx const goToDetailPage = () => { Taro.navigateTo({ url: "/pages/detail/index" }); }; // xxxx <Button onClick={goToDetailPage}>查看详情</Button> <View style='width:100%; height:500px'> <F2Canvas onCanvasInit={drawRadar} /> </View>
页面跳转正常,无论是hash模式还是browser模式。
无报错信息
Taro v2.0.2 Taro CLI 2.0.2 environment info: System: OS: macOS 10.15.3 Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.14.1 - /usr/local/bin/node Yarn: 1.21.1 - /usr/local/bin/yarn npm: 6.13.6 - /usr/local/bin/npm npmPackages: @tarojs/components: 2.0.2 => 2.0.2 @tarojs/components-qa: 2.0.2 => 2.0.2 @tarojs/mini-runner: 2.0.2 => 2.0.2 @tarojs/mobx: 2.0.2 => 2.0.2 @tarojs/mobx-h5: 2.0.2 => 2.0.2 @tarojs/router: 2.0.2 => 2.0.2 @tarojs/taro: 2.0.2 => 2.0.2 @tarojs/taro-alipay: 2.0.2 => 2.0.2 @tarojs/taro-h5: 2.0.2 => 2.0.2 @tarojs/taro-qq: 2.0.2 => 2.0.2 @tarojs/taro-quickapp: 2.0.2 => 2.0.2 @tarojs/taro-swan: 2.0.2 => 2.0.2 @tarojs/taro-tt: 2.0.2 => 2.0.2 @tarojs/taro-weapp: 2.0.2 => 2.0.2 @tarojs/webpack-runner: 2.0.2 => 2.0.2 eslint-config-taro: 2.0.2 => 2.0.2 eslint-plugin-taro: 2.0.2 => 2.0.2 nerv-devtools: ^1.5.5 => 1.5.6 nervjs: ^1.5.5 => 1.5.6 stylelint-config-taro-rn: 2.0.2 => 2.0.2 stylelint-taro-rn: 2.0.2 => 2.0.2
问题应该出在 node_modules/taro-f2/dist/h5/index.js 这个文件,其中有关于路由的代码。 此文件代码如下:
@JTXS 问题有解决方案了吗,同遇到这个问题
@JTXS @xioxin 话罢,问题解决了, 直接注视掉下面的代码 mountApis({ "basename": "/", "customRoutes": {} }, _taroHistory);
mountApis({ "basename": "/", "customRoutes": {} }, _taroHistory);
问题描述
页面A引入 taro-f2 的 F2Canvas 后,使用 Taro.navigateTo 无法跳转到页面B。 不过浏览器地址变了,并且只会变为hash模式的地址,无法变为browser模式的地址(config/index.js配置了h5 router mode 是 browser)。
期望行为
页面跳转正常,无论是hash模式还是browser模式。
报错信息
无报错信息
系统信息
Taro v2.0.2 Taro CLI 2.0.2 environment info: System: OS: macOS 10.15.3 Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.14.1 - /usr/local/bin/node Yarn: 1.21.1 - /usr/local/bin/yarn npm: 6.13.6 - /usr/local/bin/npm npmPackages: @tarojs/components: 2.0.2 => 2.0.2 @tarojs/components-qa: 2.0.2 => 2.0.2 @tarojs/mini-runner: 2.0.2 => 2.0.2 @tarojs/mobx: 2.0.2 => 2.0.2 @tarojs/mobx-h5: 2.0.2 => 2.0.2 @tarojs/router: 2.0.2 => 2.0.2 @tarojs/taro: 2.0.2 => 2.0.2 @tarojs/taro-alipay: 2.0.2 => 2.0.2 @tarojs/taro-h5: 2.0.2 => 2.0.2 @tarojs/taro-qq: 2.0.2 => 2.0.2 @tarojs/taro-quickapp: 2.0.2 => 2.0.2 @tarojs/taro-swan: 2.0.2 => 2.0.2 @tarojs/taro-tt: 2.0.2 => 2.0.2 @tarojs/taro-weapp: 2.0.2 => 2.0.2 @tarojs/webpack-runner: 2.0.2 => 2.0.2 eslint-config-taro: 2.0.2 => 2.0.2 eslint-plugin-taro: 2.0.2 => 2.0.2 nerv-devtools: ^1.5.5 => 1.5.6 nervjs: ^1.5.5 => 1.5.6 stylelint-config-taro-rn: 2.0.2 => 2.0.2 stylelint-taro-rn: 2.0.2 => 2.0.2
补充信息
问题应该出在 node_modules/taro-f2/dist/h5/index.js 这个文件,其中有关于路由的代码。 此文件代码如下: