forked from Leaf/amber-ui
修复 滚动问题
This commit is contained in:
parent
cd7314d79e
commit
57f36f0b64
@ -22,7 +22,7 @@
|
||||
|
||||
<div
|
||||
class="fixed bottom-0 left-0 right-0"
|
||||
:class="!appStore.contentScrollOnBottom ? 'hidden' : 'mb-6'"
|
||||
:class="!appStore.contentScrollOnBottom && appStore.contentScrollable ? 'hidden' : 'mb-6'"
|
||||
>
|
||||
<!-- <div
|
||||
class="mx-auto w-2xl max-w-2xl text-center mb-3 animate__animated animate__pulse text-lg"
|
||||
|
@ -29,11 +29,17 @@ const onScroll = (e: Event) => {
|
||||
const clientHeight = target.clientHeight;
|
||||
|
||||
appStore.contentScrollHeight = scrollHeight;
|
||||
appStore.contentScrollOnBottom = scrollTop + clientHeight >= scrollHeight
|
||||
appStore.contentScrollOnBottom = scrollTop + clientHeight >= scrollHeight;
|
||||
// 当前位置
|
||||
appStore.contentScrollPosition = scrollTop;
|
||||
}
|
||||
|
||||
// 检测是否能滚动(如果内容的高度还没有超过可视区域的高度)
|
||||
if (scrollHeight > clientHeight) {
|
||||
appStore.contentScrollable = true;
|
||||
} else {
|
||||
appStore.contentScrollable = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -1,20 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import { useMessage } from "naive-ui";
|
||||
import { useUserStore } from "../stores/user";
|
||||
import chat from "../components/chat/Chat.vue";
|
||||
const message = useMessage();
|
||||
const userStore = useUserStore();
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- <router-link to="auth/login">go</router-link> -->
|
||||
<!-- <n-dropdown trigger="hover" :options="options" @select="handleSelect">
|
||||
<n-button>找个地方休息111</n-button>
|
||||
</n-dropdown>
|
||||
|
||||
<n-button @click="logout()">退出登录</n-button> -->
|
||||
|
||||
<Chat />
|
||||
</template>
|
||||
|
||||
|
@ -8,5 +8,6 @@ export const useAppStore = defineStore("app", {
|
||||
contentScrollHeight: 0,
|
||||
contentScrollPosition: 0,
|
||||
contentScrollOnBottom: false,
|
||||
contentScrollable: false,
|
||||
}),
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user