feat: 切换路由自动滚动到最顶部

This commit is contained in:
liulujian 2026-04-08 16:38:51 +08:00
parent b3a9601b5f
commit 012c48c5dd

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<Nav @gotoIfreamPage="gotoIfreamPage" @gotoPage="gotoPage" /> <Nav @gotoIfreamPage="gotoIfreamPage" @gotoPage="gotoPage" />
<div :style="{ 'height': documentClientHeight-65 + 'px' ,'margin-top':'64px' ,'overflow':'auto'}"> <div ref="contentWrap" :style="{ 'height': documentClientHeight-65 + 'px' ,'margin-top':'64px' ,'overflow':'auto'}">
<iframe v-if="iframeUrl" :src="iframeUrl" width="100%" height="100%" frameborder="0" scrolling="yes"> <iframe v-if="iframeUrl" :src="iframeUrl" width="100%" height="100%" frameborder="0" scrolling="yes">
</iframe> </iframe>
<keep-alive v-else> <keep-alive v-else>
@ -24,6 +24,12 @@ export default {
components: { components: {
Nav, Nav,
}, },
watch: {
$route() {
//
this.$refs.contentWrap && (this.$refs.contentWrap.scrollTop = 0);
},
},
computed: { computed: {
// documentClientHeight: { // documentClientHeight: {
// get() { // get() {