Skip to content
New issue

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

fix(alipay): support root-portal component #14171

Merged
merged 8 commits into from
Oct 31, 2023

Conversation

TheKonka
Copy link
Member

#14168

这个 PR 做了什么? (简要描述所做更改)
支持支付宝小程序 root-portal 组件
https://opendocs.alipay.com/mini/05snwp

这个 PR 是什么类型? (至少选择一个)

这个 PR 涉及以下平台:

  • 所有小程序
  • 微信小程序
  • 支付宝小程序
  • 百度小程序
  • 字节跳动小程序
  • QQ 轻应用
  • 京东小程序
  • 快应用平台(QuickApp)
  • Web 平台(H5)
  • 移动端(React-Native)
  • 鸿蒙(harmony)

@lupingW
Copy link

lupingW commented Aug 14, 2023

import { useRouter } from '@tarojs/taro'
import { createPortal } from "@tarojs/react";
import { useLayoutEffect, useState } from "react";

const RootPortal = ({ children, enable = true }) => {
  const router = useRouter()
  const [dom, setDom] = useState()

  useLayoutEffect(() => {
    const _dom = document.getElementById(router.$taroPath);
    _dom && setDom(_dom)
  }, [router.$taroPath])

  return (enable && dom) ? createPortal(children, _dom) : children
}

export default RootPortal

可以暂时用这个

@Chen-jj
Copy link
Contributor

Chen-jj commented Oct 31, 2023

感谢贡献~

@Chen-jj Chen-jj merged commit 2f8c864 into NervJS:next Oct 31, 2023
4 checks passed
@TheKonka TheKonka deleted the alipay-rootportal branch October 31, 2023 14:29
moseszhou added a commit to moseszhou/taro that referenced this pull request Nov 1, 2023
* next:
  fix: 修复babel-plugin-transform-taroapi插件对canIUse入参scheme处理问题 (NervJS#14717)
  feat: deriveDataFromProps逻辑抽离到/plugin-platform-alipay
  fix(alipay): support root-portal component (NervJS#14171)
  fix(plugin-inject): 修复 Vue2 使用 componentsMap 配置时报错的问题,NervJS#13299 NervJS#14520 (NervJS#14607)
  fix(weapp): `Map` attribute replenishment
  refactor(types): sync components types
  fix(weapp): `LivePlayer` attribute replenishment (NervJS#14668)
  fix(tt): `Input` attribute replenishment
  types: 根据文档补充配置 enableSourceMap 类型
  fix(weapp): 完善微信小程序视频号相关组件的属性实现,fix NervJS#14608
  chore: 添加提示文案
  fix: 支付宝渲染问题, 当页面复杂,CustomWrapper和page都有数据更新时,CustomWrapper的UI有几率出现不更新的情况
  Revert "perf: rn端sass文件引入路径包含别名时支持~,例如: @import ’~@/common/baseStyle.scss‘"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RootPortal支付宝官方已经有了,Taro暂时还不支持么?
4 participants