-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat: add teleportRootEl config #35
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThis update introduces a new reactive variable Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!pnpm-lock.yaml
Files selected for processing (5)
- playground/src/pages/index/index.vue (2 hunks)
- playground/src/uni-pages.d.ts (1 hunks)
- playground/vite.config.ts (1 hunks)
- src/context.ts (1 hunks)
- src/types.ts (1 hunks)
Files skipped from review due to trivial changes (1)
- playground/src/uni-pages.d.ts
Additional comments not posted (3)
playground/vite.config.ts (1)
16-16
: Ensure the dynamic behavior ofteleportRootEl
is tested across different platforms and scenarios.src/types.ts (1)
21-21
: The addition ofteleportRootEl
toResolvedOptions
is correctly implemented.playground/src/pages/index/index.vue (1)
53-54
: The CSS forlong-block
is correctly added to handle specific layout requirements.
const popShow = ref<boolean>(true); | ||
function handleChange() { | ||
popShow.value = !popShow.value; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that the function handleChange
and variable popShow
are adequately commented to explain their purpose in the UI interaction.
+ // `popShow` controls the visibility of the page meta style.
+ // `handleChange` toggles the `popShow` state.
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
const popShow = ref<boolean>(true); | |
function handleChange() { | |
popShow.value = !popShow.value; | |
} | |
// `popShow` controls the visibility of the page meta style. | |
const popShow = ref<boolean>(true); | |
// `handleChange` toggles the `popShow` state. | |
function handleChange() { | |
popShow.value = !popShow.value; | |
} |
if (this.options.teleportRootEl) { | ||
ms.overwrite(sfc.template?.loc.start.offset, sfc.template?.loc.end.offset, `\n${this.options.teleportRootEl}\n<layout-${pageLayout?.kebabName}-uni ${pageLayoutProps.join(' ')}>${sfc.template.content}</layout-${pageLayout?.kebabName}-uni>\n`) | ||
} else { | ||
ms.overwrite(sfc.template?.loc.start.offset, sfc.template?.loc.end.offset, `<layout-${pageLayout?.kebabName}-uni ${pageLayoutProps.join(' ')}>${sfc.template.content}</layout-${pageLayout?.kebabName}-uni>\n`) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
Missing Test Cases for teleportRootEl
The search did not find any test cases handling teleportRootEl
. It is crucial to add tests to ensure comprehensive coverage, especially for edge cases where teleportRootEl
might be undefined or have unexpected values.
- Add test cases in
test/context.test.ts
to cover scenarios with and withoutteleportRootEl
.
Analysis chain
The conditional handling of teleportRootEl
is implemented correctly. Ensure comprehensive testing, especially for edge cases where teleportRootEl
might be undefined or have unexpected values.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the handling of `teleportRootEl` for edge cases.
# Test: Search for edge cases in the usage of `teleportRootEl`.
rg --type ts $'teleportRootEl'
Length of output: 555
Script:
#!/bin/bash
# Description: Search for test cases or usage examples handling `teleportRootEl`.
# Search for test files or directories
test_files=$(fd --type f --name "*.test.ts")
# Search for `teleportRootEl` usage in test files
for file in $test_files; do
rg --type ts 'teleportRootEl' "$file"
done
Length of output: 298
Script:
#!/bin/bash
# Description: Search for test cases or usage examples handling `teleportRootEl`.
# Search for test files or directories
test_files=$(fd --type f '.test.ts')
# Search for `teleportRootEl` usage in test files
for file in $test_files; do
rg --type ts 'teleportRootEl' "$file"
done
Length of output: 1142
hi,感谢 PR, 当前的实现不是很优雅,如果是我的话,我应该会直接支持类似如下的方法(也许还有更好的),需要 @ModyQyW 来讨论下~ // 约定一个特殊的 slot,(不知道能不能实现)
<template>
<template #layout:after>
<page-meta />
</template>
<template #header>
layout 的 header 插槽
</template>
<view>...page code</view>
<template #footer>
layout 的 footer 插槽
</template>
<template> 正好,顺便可以直接支持一下不使用 |
我试着改一下 |
我的想法大致和这里一致。我感觉这里应该是写错了,不是 #layout:after 而是 #layout:before( 必须是页面第一个元素)。如果可以,同时支持 #layout:before 和 #layout:after 会更好。可以先尝试一下看看,不确定能不能实现🤔 |
有更新吗?有同样需求 |
Description 描述
增加teleportRootEl,解决uni在小程序中使用layout无法添加page-meta来解决滚动穿透问题
Linked Issues 关联的 Issues
#34
Additional context 额外上下文
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Configuration