自动展开回复

This commit is contained in:
yu 2023-10-01 11:57:36 +08:00 committed by laoxong
parent 0cfbb648b0
commit 24bab4ca5d

View File

@ -12,9 +12,9 @@ SPDX-License-Identifier: AGPL-3.0-only
:class="$style.root" :class="$style.root"
> >
<div v-if="appearNote.reply && appearNote.reply.replyId"> <div v-if="appearNote.reply && appearNote.reply.replyId">
<div v-if="!conversationLoaded" style="padding: 16px"> <!-- <div v-if="!conversationLoaded" style="padding: 16px">
<MkButton style="margin: 0 auto;" primary rounded @click="loadConversation">{{ i18n.ts.loadConversation }}</MkButton> <MkButton style="margin: 0 auto;" primary rounded @click="loadConversation">{{ i18n.ts.loadConversation }}</MkButton>
</div> </div> -->
<MkNoteSub v-for="note in conversation" :key="note.id" :class="$style.replyToMore" :note="note"/> <MkNoteSub v-for="note in conversation" :key="note.id" :class="$style.replyToMore" :note="note"/>
</div> </div>
<MkNoteSub v-if="appearNote.reply" :note="appearNote.reply" :class="$style.replyTo"/> <MkNoteSub v-if="appearNote.reply" :note="appearNote.reply" :class="$style.replyTo"/>
@ -137,9 +137,9 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> </div>
<div> <div>
<div v-if="tab === 'replies'" :class="$style.tab_replies"> <div v-if="tab === 'replies'" :class="$style.tab_replies">
<div v-if="!repliesLoaded" style="padding: 16px"> <!-- <div v-if="!repliesLoaded" style="padding: 16px">
<MkButton style="margin: 0 auto;" primary rounded @click="loadReplies">{{ i18n.ts.loadReplies }}</MkButton> <MkButton style="margin: 0 auto;" primary rounded @click="loadReplies">{{ i18n.ts.loadReplies }}</MkButton>
</div> </div> -->
<MkNoteSub v-for="note in replies" :key="note.id" :note="note" :class="$style.reply" :detail="true"/> <MkNoteSub v-for="note in replies" :key="note.id" :note="note" :class="$style.reply" :detail="true"/>
</div> </div>
<div v-else-if="tab === 'renotes'" :class="$style.tab_renotes"> <div v-else-if="tab === 'renotes'" :class="$style.tab_renotes">
@ -495,9 +495,9 @@ function blur() {
el.value.blur(); el.value.blur();
} }
const repliesLoaded = ref(false); // const repliesLoaded = ref(false);
function loadReplies() { function loadReplies() {
repliesLoaded.value = true; // repliesLoaded.value = true;
os.api('notes/children', { os.api('notes/children', {
noteId: appearNote.id, noteId: appearNote.id,
limit: 30, limit: 30,
@ -506,15 +506,20 @@ function loadReplies() {
}); });
} }
const conversationLoaded = ref(false); // const conversationLoaded = ref(false);
function loadConversation() { function loadConversation() {
conversationLoaded.value = true; // conversationLoaded.value = true;
os.api('notes/conversation', { os.api('notes/conversation', {
noteId: appearNote.replyId, noteId: appearNote.replyId,
}).then(res => { }).then(res => {
conversation.value = res.reverse(); conversation.value = res.reverse();
}); });
} }
onMounted(()=>{
loadReplies();
loadConversation();
});
</script> </script>
<style lang="scss" module> <style lang="scss" module>