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

vuedraggable@nextNButton 无法使用 #2882

Closed
Air-Cooled opened this issue May 3, 2022 · 6 comments
Closed

vuedraggable@nextNButton 无法使用 #2882

Air-Cooled opened this issue May 3, 2022 · 6 comments

Comments

@Air-Cooled
Copy link

Air-Cooled commented May 3, 2022

TuSimple/naive-ui version (版本)

2.28.2

Vue version (Vue 版本)

3.2.25

Browser and its version (浏览器及其版本)

Chrome( 100.0.4896.127)

System and its version (系统及其版本)

win 10

Node version (Node 版本)

v16.13.2

Reappearance link (重现链接)

https://github.com/SortableJS/vue.draggable.next

Reappearance steps (重现步骤)

<draggable v-model="list"  item-key="id">
  <template #item="{element}">
      <n-button> {{element.name}} </n-button>
  </template>
</draggable>

Expected results (期望的结果)

点击 button 可以进行拖拽

Actual results (实际的结果)

点击 button 无法拖拽,
换为 div 即可拖拽,但在 div 内 button 上点击依旧无法进行拖拽

Remarks (补充说明)

@github-actions github-actions bot added the untriaged need to sort label May 3, 2022
@07akioni
Copy link
Collaborator

07akioni commented May 4, 2022

这个问题你可以给 vuedraggable 提 issue

@07akioni 07akioni removed the untriaged need to sort label May 4, 2022
@07akioni 07akioni closed this as completed May 4, 2022
@Air-Cooled
Copy link
Author

这个问题你可以给 vuedraggable 提 issue

element-plusbutton 是可以正常使用的,确定不是 naive-ui 的问题?

@07akioni
Copy link
Collaborator

07akioni commented May 4, 2022

这个问题你可以给 vuedraggable 提 issue

element-plusbutton 是可以正常使用的,确定不是 naive-ui 的问题?

一般来说,一个库(比如 draggable)要如果选择接受第三方的组件,这个库就要处理第三方的组件对应的实现。如果功能不能正常运作的话,多数情况是这个库没有处理一些边界情况。

你要看谁是这个功能的实现方,比如点击功能是 naive 实现的,那么你来提一个 bug 肯定会优先看,但是这个功能不是 naive 实现的,所以优先应该让 draggable 去看为什么它对于某些组件不生效。

如果 draggable 指出是 naive 的某些实现导致他们的实现不生效了,那么之后是可以评估一下究竟是不是需要改一下 naive 的实现。

@lakca
Copy link

lakca commented May 5, 2022

mousedown阻止默认事件导致dragstart不会触发。

@07akioni 为啥这块需要preventDefault()https://github.com/TuSimple/naive-ui/blob/main/src/button/src/Button.tsx#L157

如果真的必须的话,可以放在https://github.com/TuSimple/naive-ui/blob/main/src/button/src/Button.tsx#L161里面。

@07akioni
Copy link
Collaborator

07akioni commented May 6, 2022

https://github.com/TuSimple/naive-ui/blob/main/src/button/src/Button.tsx#L157

我也记不太清了

mousedown阻止默认事件导致dragstart不会触发。

@07akioni 为啥这块需要preventDefault()https://github.com/TuSimple/naive-ui/blob/main/src/button/src/Button.tsx#L157。

如果真的必须的话,可以放在https://github.com/TuSimple/naive-ui/blob/main/src/button/src/Button.tsx#L161里面。

因为不 preventDefault 的话 button 点击后无法在 safari 被聚焦

@07akioni
Copy link
Collaborator

07akioni commented May 6, 2022

加了一个属性可以关掉这个行为

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

3 participants