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

支持拖拽数据场景 #18

Open
hunter2009 opened this issue Oct 23, 2019 · 6 comments
Open

支持拖拽数据场景 #18

hunter2009 opened this issue Oct 23, 2019 · 6 comments

Comments

@hunter2009
Copy link
Contributor

Cafe这边PM有个诉求,希望能收集到卡片拖起、放置的使用情况,不知道目前有方式可以收集到么?

@otakustay
Copy link
Member

你希望是什么形式的API,怎么调用,能起到什么效果?

@otakustay
Copy link
Member

const onDragStart = useTrackEvent(category, action, label, props.onDragStart);

<div onDragStart={onDragStart}>

这样子?

@hunter2009
Copy link
Contributor Author

现在是用的hooks,useDrag和useDrop,想要这么收集

const [{isDragging}, dragRef, preview] = useDrag({
   begin() {
        // TODO 卡片托起的操作频率
   },
   end() {
        // TODO 卡片放下的操作频率
    }
})

@otakustay
Copy link
Member

你希望在此基础上增加怎么样的能力,希望最终的使用方式是怎么样的?

@hunter2009
Copy link
Contributor Author

更灵活的使用方式;可以在callback中使用

const trackEvent = useTrackEvent(...);
const [{isDragging}, dragRef, preview] = useDrag({
   begin() {
        trackEvent({type: xxxDrag});
   },
   end() {
        trackEvent({type: xxxDrop});
    }
})

这么做侵染性有点强...你那边有什么建议?

@otakustay
Copy link
Member

otakustay commented Oct 23, 2019 via email

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

No branches or pull requests

2 participants