diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 6e57d0dd2..9d54ec326 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -13,6 +13,10 @@ - `n-menu` add `render-extra` prop. - `n-select` add `on-clear` prop. +### Fixes + +- Fix `n-dropdown` click exception when using v-for. + ## 2.15.11 (2021-07-29) ### Fixes diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 940f30daf..1f19f57a2 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -13,6 +13,10 @@ - `n-menu` 新增 `render-extra` 属性 - `n-select` 新增 `on-clear` 属性 +### Fixes + +- 修复 `n-dropdown` 循环渲染时点击异常 + ## 2.15.11 (2021-07-29) ### Fixes diff --git a/src/popover/src/Popover.ts b/src/popover/src/Popover.ts index a97366313..1b15b338c 100644 --- a/src/popover/src/Popover.ts +++ b/src/popover/src/Popover.ts @@ -10,7 +10,8 @@ import { CSSProperties, ComputedRef, Ref, - toRef + toRef, + cloneVNode } from 'vue' import { VBinder, VTarget, FollowerPlacement } from 'vueuc' import { useMergedState, useCompitable, useIsMounted, useMemo } from 'vooks' @@ -396,6 +397,7 @@ export default defineComponent({ triggerVNode = getFirstSlotVNode(slots, 'trigger') } if (triggerVNode) { + triggerVNode = cloneVNode(triggerVNode) triggerVNode = triggerVNode.type === textVNodeType ? h('span', [triggerVNode])