Skip to content

feat: 支持 teleport 组件转化为 root-portal 组件#6007

Open
chouchouji wants to merge 8 commits into
uni-app-vue3-devfrom
feat-teleport-to-root-portal
Open

feat: 支持 teleport 组件转化为 root-portal 组件#6007
chouchouji wants to merge 8 commits into
uni-app-vue3-devfrom
feat-teleport-to-root-portal

Conversation

@chouchouji

@chouchouji chouchouji commented Jun 4, 2026

Copy link
Copy Markdown
Member

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

Size report

Path Size
packages/size-check/dist/size-check.es.js 52.9 KB (0%)
packages/size-check/dist/style.css 2.83 KB (0%)
packages/uni-app/dist/uni-app.es.js 2.64 KB (0%)
packages/uni-h5-vue/dist/vue.runtime.esm.js 76.48 KB (0%)
packages/uni-mp-vue/dist/vue.runtime.esm.js 43.74 KB (0%)
packages/uni-mp-alipay/dist/uni.api.esm.js 15.51 KB (0%)
packages/uni-mp-alipay/dist/uni.mp.esm.js 8.19 KB (0%)
packages/uni-mp-baidu/dist/uni.api.esm.js 11.78 KB (0%)
packages/uni-mp-baidu/dist/uni.mp.esm.js 9.68 KB (0%)
packages/uni-mp-qq/dist/uni.api.esm.js 11.11 KB (0%)
packages/uni-mp-qq/dist/uni.mp.esm.js 7.6 KB (0%)
packages/uni-mp-toutiao/dist/uni.api.esm.js 11.06 KB (0%)
packages/uni-mp-toutiao/dist/uni.mp.esm.js 9.42 KB (0%)
packages/uni-mp-weixin/dist/uni.api.esm.js 12.14 KB (0%)
packages/uni-mp-weixin/dist/uni.mp.esm.js 8.16 KB (0%)
packages/uni-quickapp-webview/dist/uni.api.esm.js 11.06 KB (0%)
packages/uni-quickapp-webview/dist/uni.mp.esm.js 8.16 KB (0%)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds compiler support for converting Vue <teleport> usage into the mini-program native/open component <root-portal>, enabling Teleport-like behavior in supported mini-program targets.

Changes:

  • Introduces a new Vue AST node transform transformTeleport in uni-cli-shared to rewrite <teleport> to <root-portal>, remove to, and map disabledenable (inverted).
  • Wires transformTeleport into the compiler nodeTransforms pipelines for Weixin / Alipay / JD mini-program targets.
  • Adds X-mode compiler test coverage validating the generated template/render output for teleport cases.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/uni-mp-weixin/src/compiler/options.ts Registers transformTeleport in the Weixin mini-program compiler node transform chain.
packages/uni-mp-jd/src/compiler/options.ts Registers transformTeleport in the JD mini-program compiler node transform chain.
packages/uni-mp-alipay/src/compiler/options.ts Registers transformTeleport in the Alipay mini-program compiler node transform chain.
packages/uni-cli-shared/src/vue/transforms/transformTeleport.ts Adds the new transform implementation that rewrites Teleport nodes to root-portal.
packages/uni-cli-shared/src/vue/transforms/index.ts Re-exports transformTeleport from the transforms entrypoint.
packages/uni-mp-compiler/tests/tagAndPropForX.spec.ts Adds test cases covering teleport-to-root-portal rewriting (including disabled).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/uni-cli-shared/src/vue/transforms/transformTeleport.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment on lines +24 to +30
if (node.tag !== 'teleport') {
return
}

node.tag = 'root-portal'
node.tagType = ElementTypes.ELEMENT

@Allmeekadoo Allmeekadoo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I what you to

@Allmeekadoo Allmeekadoo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ok

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.

4 participants