We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
H5
https://github.com/yulrosy/taro-issue.git 浏览器版本: Chrome 83 使用框架: React
tab页正常显示
tab页空白
Taro CLI 2.2.9 environment info: System: OS: macOS 10.15.4 Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.16.2 - /var/folders/fs/4t8db8ns0_5g18dbtgs9h2fc0000gn/T/yarn--1593659530960-0.5098437793808264/node Yarn: 1.22.4 - /var/folders/fs/4t8db8ns0_5g18dbtgs9h2fc0000gn/T/yarn--1593659530960-0.5098437793808264/yarn npm: 6.14.4 - ~/.nvs/default/bin/npm npmPackages: @tarojs/cli: 2.2.9 => 2.2.9 @tarojs/components: 2.2.9 => 2.2.9 @tarojs/mini-runner: 2.2.9 => 2.2.9 @tarojs/plugin-sass: 2.2.9 => 2.2.9 @tarojs/plugin-terser: ^2.2.9 => 2.2.9 @tarojs/router: 2.2.9 => 2.2.9 @tarojs/taro: 2.2.9 => 2.2.9 @tarojs/taro-h5: 2.2.9 => 2.2.9 @tarojs/taro-weapp: 2.2.9 => 2.2.9 @tarojs/webpack-runner: 2.2.9 => 2.2.9 nerv-devtools: ^1.5.7 => 1.5.7 nervjs: ^1.5.7 => 1.5.7
The text was updated successfully, but these errors were encountered:
我也遇到这种情况,解决方案【暂时】:
/** * // NOTE 后端返回的 url 可能是网页链接,需要在 webview 中打开 * 也可能是小程序自身的链接,只能用 navigate/redirect 之类的打开 * 就需要有个地方统一判断处理 */ export default function jump(options) { const { url, title = '', payload = {}, method = 'navigateTo' } = options if (/^https?:\/\//.test(url)) { Taro[method]({ url: urlStringify(PAGE_WEBVIEW, { url, title }) }) } else if (/^\/pages\//.test(url)) { // TODO H5 不支持 switchTab,暂时 hack 下 if (process.env.TARO_ENV === 'h5' && method === 'switchTab') { Taro.navigateBack({ delta: Taro.getCurrentPages().length - 1 }) setTimeout(() => { Taro.redirectTo({ url }) }, 100) return } Taro[method]({ url: urlStringify(url, payload) }) } }
在二级页面调用就行了
import jump from '../../../utils/jump' jump({ url: item.url, method: 'switchTab' })
Sorry, something went wrong.
feat: switchTab on pages route to fix #6878
d24cf55
b3465bb
ZakaryCode
Successfully merging a pull request may close this issue.
相关平台
H5
复现仓库
https://github.com/yulrosy/taro-issue.git
浏览器版本: Chrome 83
使用框架: React
复现步骤
期望结果
tab页正常显示
实际结果
tab页空白
环境信息
The text was updated successfully, but these errors were encountered: