feat: scroll reply highlight

This commit is contained in:
KUN1007 2023-09-17 15:05:04 +08:00
parent b2807f89dd
commit 5c5f7f20bd
4 changed files with 20 additions and 4 deletions

View file

@ -68,8 +68,6 @@ const getReplies = async (): Promise<TopicReply[]> => {
return (await useKUNGalgameTopicStore().getReplies(tid.value)).data
}
//
// getReplies watch
watch(
() => [
@ -106,6 +104,12 @@ watchEffect(async () => {
// style
if (childElement) {
childElement.scrollIntoView({ behavior: 'smooth', block: 'center' })
childElement.classList.add('active')
//
await new Promise((resolve) => {
setTimeout(resolve, 3000)
})
childElement.classList.remove('active')
}
scrollToReplyId.value = -1
}

View file

@ -94,8 +94,6 @@ const {
display: flex;
flex-direction: column;
align-items: center;
/* 楼主话题距离其它人话题的距离 */
margin-bottom: 5px;
flex-shrink: 0;
/* TODO: */
/* 楼主话题背景图 */

View file

@ -145,6 +145,7 @@ defineProps<{
border-radius: 5px;
background-color: var(--kungalgame-trans-white-5);
box-shadow: var(--shadow);
transition: all 0.5s;
}
/* 其它人回复的内容区 */
.content {
@ -160,6 +161,7 @@ defineProps<{
}
/* 其它人回复的上部右侧区域 */
.right {
width: 100%;
display: flex;
flex-direction: column;
}
@ -203,6 +205,12 @@ defineProps<{
color: var(--kungalgame-font-color-3);
}
/* 滚动到指定话题激活后的样式 */
.active .container {
border: 2px solid var(--kungalgame-red-3);
background-color: var(--kungalgame-trans-red-1);
}
@media (max-width: 1000px) {
.top {
flex-direction: column;

View file

@ -23,4 +23,10 @@ span {
align-items: center;
color: var(--kungalgame-font-color-3);
}
@media (max-width: 1000px) {
span {
margin-right: 10px;
}
}
</style>