Skip to content

Commit

Permalink
fix(ui/menu): modify the implementation of sloving offsetHeight error
Browse files Browse the repository at this point in the history
  • Loading branch information
liyang authored and haoziqaq committed Dec 30, 2021
1 parent d05a7f9 commit 9871022
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/varlet-ui/src/menu/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@ export default defineComponent({
// expose
const resize = () => {
nextTick(() => {
top.value = computeTop(props.alignment)
left.value = getLeft(host.value as HTMLElement)
})
top.value = computeTop(props.alignment)
left.value = getLeft(host.value as HTMLElement)
}
watch(() => props.alignment, resize)
Expand All @@ -79,7 +77,10 @@ export default defineComponent({
() => props.show,
async (newValue: boolean) => {
const { onOpen, onClose } = props
newValue && resize()
if (newValue) {
await nextTick()
resize()
}
newValue ? onOpen?.() : onClose?.()
}
)
Expand Down

0 comments on commit 9871022

Please sign in to comment.