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

refactor(popup): sfc to tsx #1401

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

refactor(popup): sfc to tsx #1401

wants to merge 1 commit into from

Conversation

betavs
Copy link
Collaborator

@betavs betavs commented May 17, 2024

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

💡 需求背景和解决方案

📝 更新日志

  • refactor(Popup): sfc to tsx

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@betavs betavs added the sfc changed to tsx sfc changed to tsx label May 17, 2024
Copy link
Contributor

github-actions bot commented May 17, 2024

完成

@@ -31,21 +17,25 @@ let lockTimes = 0;

export default defineComponent({
name,
components: { TNode, TOverlay },
inheritAttrs: false,
props: popupProps,
Copy link
Collaborator

Choose a reason for hiding this comment

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

import props from './props';

这里简写~

@anlyyao
Copy link
Collaborator

anlyyao commented Jun 6, 2024

test 挂了,有空继续关注一下哦~

@betavs
Copy link
Collaborator Author

betavs commented Aug 1, 2024

@anlyyao 功能没有问题,不止 popup 单测挂了;貌似是单测有问题 🤔

src/popup/popup.tsx Outdated Show resolved Hide resolved
@liweijie0812
Copy link
Collaborator

/update-snapshot

Copy link
Contributor

⏳ 正在运行快照更新。。。 CI: Open

@liweijie0812
Copy link
Collaborator

测试案例没过需要处理下

�[7m FAIL �[27m src/action-sheet/__test__/index.test.jsx�[2m > ActionSheet�[2m > props�[2m > visible
AssertionError: expected true to be falsy

- Expected
+ Received

- false
+ true

 �[2m❯ src/action-sheet/__test__/index.test.jsx:�[2m116:57
    114|         },
    115|       });
    116|       expect(wrapper.find(`.${prefix}-popup`).exists()).toBeFalsy();
       |                                                         ^
    117|       await wrapper.setProps({
    118|         visible: true,

�[2m⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

@@ -133,7 +112,7 @@ export default defineComponent({

useLockScroll(popupRef, () => wrapperVisible.value && props.preventScrollThrough, popupClass.value);

return {
context.expose({
Copy link
Collaborator

Choose a reason for hiding this comment

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

expose 是为了?


const renderPopupContent =
process.env.NODE_ENV === 'production' ? (
<Teleport to={to.value} disabled={!to.value}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

可以直接用useTeleport()

import { getAttach } from '../shared/dom';
import { usePrefixClass } from '../hooks/useClass';
import { useLockScroll } from '../hooks/useLockScroll';
import { useContent, useTNodeJSX } from '@/hooks/tnode';
Copy link
Collaborator

Choose a reason for hiding this comment

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

用相对路径,别名打包会有问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sfc changed to tsx sfc changed to tsx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants