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

feat: useMouse #147

Merged
merged 4 commits into from
Nov 18, 2019
Merged

feat: useMouse #147

merged 4 commits into from
Nov 18, 2019

Conversation

ttys026
Copy link
Collaborator

@ttys026 ttys026 commented Nov 12, 2019

No description provided.

@vercel
Copy link

vercel bot commented Nov 12, 2019

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/umijs/hooks/5soscs0d4
🌍 Preview: https://hooks-git-feat-usemouse.umijs.now.sh

src/useMouse/index_cn.mdx Outdated Show resolved Hide resolved
src/useMouse/index_cn.mdx Outdated Show resolved Hide resolved
src/useMouse/index_cn.mdx Outdated Show resolved Hide resolved
src/useMouse/index.ts Outdated Show resolved Hide resolved
src/useMouse/index.ts Outdated Show resolved Hide resolved
src/useMouse/index_cn.mdx Outdated Show resolved Hide resolved
src/useMouse/index.ts Outdated Show resolved Hide resolved
src/useMouse/demo/demo2.tsx Outdated Show resolved Hide resolved
src/useMouse/demo/demo1.tsx Show resolved Hide resolved
src/useSize/index.ts Outdated Show resolved Hide resolved
@brickspert
Copy link
Collaborator

Copy link
Collaborator

@brickspert brickspert left a comment

Choose a reason for hiding this comment

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

export from src/index.ts ?

src/useMouse/demo/demo1.tsx Show resolved Hide resolved

# useMouse

一个跟踪鼠标位置的 hook
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hook 大写~

@@ -3,15 +3,15 @@ import ResizeObserver from 'resize-observer-polyfill';

type Arg = HTMLElement | (() => HTMLElement) | null;

type Size = { width: number; height: number };
type Size = { width: number; height: number; top: number; left: number };
Copy link
Collaborator

Choose a reason for hiding this comment

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

我还是认为 useSize 加上 top 和 left 不太合适。 @awmleer

Copy link
Collaborator

Choose a reason for hiding this comment

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

我觉得加上也不是不可以,毕竟有的时候还是会用到 topleft 的。。(虽然语义上有点奇怪)

@brickspert
Copy link
Collaborator

export from src/index.ts ?

Copy link
Collaborator

@awmleer awmleer left a comment

Choose a reason for hiding this comment

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

LGTM

@awmleer
Copy link
Collaborator

awmleer commented Nov 18, 2019

也许可以做一层性能上的优化,就是像 useResponsive 一样全局只绑定一个公用的事件回调,这样不用每个组件都自己绑定一次事件了。。

不过可能也不是很要紧。。

@brickspert
Copy link
Collaborator

也许可以做一层性能上的优化,就是像 useResponsive 一样全局只绑定一个公用的事件回调,这样不用每个组件都自己绑定一次事件了。。

不过可能也不是很要紧。。

good idea,不过这个以后再做吧~~

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.

3 participants