feat: scroll reply highlight
This commit is contained in:
parent
b2807f89dd
commit
5c5f7f20bd
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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: */
|
||||||
/* 楼主话题背景图 */
|
/* 楼主话题背景图 */
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue