feat: 切换路由自动滚动到最顶部
This commit is contained in:
parent
b3a9601b5f
commit
012c48c5dd
@ -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() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user