mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(cli): improve nav scroll position
This commit is contained in:
parent
d511508e3b
commit
6929b04d56
@ -35,6 +35,24 @@ export default {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
active() {
|
||||||
|
this.scrollIntoView();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.scrollIntoView();
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
scrollIntoView() {
|
||||||
|
if (this.active && this.$el && this.$el.scrollIntoViewIfNeeded) {
|
||||||
|
this.$el.scrollIntoViewIfNeeded();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user