使用 iframe 去访问一个使用了当前组件的页面,页面会报错

Open
#482 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
react, typescript
Domain
frontend

Research direction

Start with the CodeSandbox reproduction and embed the Image component documentation page in an iframe, then switch the sidebar examples to reproduce the error. Inspect src/hooks/useMouseEvent.ts lines 99-125 alongside the reported screenshot. Done means the embedded page no longer errors while changing examples, with behavior preserved outside an iframe.

Written by the indexing model from the issue text.

Description

报错如下:
Image

目测是以下代码导致:
https://github.com/react-component/image/blob/de622e336a4f9f52c6f49ab5093f820e6dfb5590/src/hooks/useMouseEvent.ts#L99-L125

示例:
内嵌页面为 Image 组件官网,切换侧边示例会复现上述错误
https://codesandbox.io/p/sandbox/jkt7tk

Dominant language
TypeScript
Stars
211
Forks
128
Avg merge
2d 23h
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from react-component/image

All issues in react-component/image

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.