Skip to content

Commit

Permalink
fix(ui/menu): reslove error of getting offsetHeight when alignment is…
Browse files Browse the repository at this point in the history
… set as bottom
  • Loading branch information
liyang authored and haoziqaq committed Dec 30, 2021
1 parent 8e6ea6d commit d05a7f9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/varlet-ui/src/menu/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</template>

<script lang="ts">
import { defineComponent, ref, watch, onMounted, onUnmounted } from 'vue'
import { defineComponent, ref, watch, onMounted, onUnmounted, nextTick } from 'vue'
import { props } from './props'
import { getLeft, getTop, toSizeUnit } from '../utils/elements'
import { useZIndex } from '../context/zIndex'
Expand Down Expand Up @@ -67,8 +67,10 @@ export default defineComponent({
// expose
const resize = () => {
top.value = computeTop(props.alignment)
left.value = getLeft(host.value as HTMLElement)
nextTick(() => {
top.value = computeTop(props.alignment)
left.value = getLeft(host.value as HTMLElement)
})
}
watch(() => props.alignment, resize)
Expand Down

0 comments on commit d05a7f9

Please sign in to comment.