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

View file

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

View file

@ -145,6 +145,7 @@ defineProps<{
border-radius: 5px; border-radius: 5px;
background-color: var(--kungalgame-trans-white-5); background-color: var(--kungalgame-trans-white-5);
box-shadow: var(--shadow); box-shadow: var(--shadow);
transition: all 0.5s;
} }
/* 其它人回复的内容区 */ /* 其它人回复的内容区 */
.content { .content {
@ -160,6 +161,7 @@ defineProps<{
} }
/* 其它人回复的上部右侧区域 */ /* 其它人回复的上部右侧区域 */
.right { .right {
width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
@ -203,6 +205,12 @@ defineProps<{
color: var(--kungalgame-font-color-3); 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) { @media (max-width: 1000px) {
.top { .top {
flex-direction: column; flex-direction: column;

View file

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