mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 18:54:24 +00:00
fix(DropdownMenu): menu ref may not exist in some cases (#5770)
This commit is contained in:
@@ -53,8 +53,11 @@ export default createComponent({
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
updateOffset() {
|
updateOffset() {
|
||||||
const { menu } = this.$refs;
|
if (!this.$refs.menu) {
|
||||||
const rect = menu.getBoundingClientRect();
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const rect = this.$refs.menu.getBoundingClientRect();
|
||||||
|
|
||||||
if (this.direction === 'down') {
|
if (this.direction === 'down') {
|
||||||
this.offset = rect.bottom;
|
this.offset = rect.bottom;
|
||||||
|
Reference in New Issue
Block a user