feat: add util to create MessageReply instance
This commit is contained in:
parent
53c2f93791
commit
2ff892b0da
1 changed files with 9 additions and 0 deletions
|
@ -1,5 +1,14 @@
|
|||
import { render } from "vue";
|
||||
import MessageReply from "~/components/MessageReply.vue";
|
||||
import type { MessageProps } from "~/types/props";
|
||||
|
||||
export default (element: HTMLDivElement, props: MessageProps) => {
|
||||
console.log("element:", element);
|
||||
const messageBox = document.getElementById("message-box") as HTMLDivElement;
|
||||
if (messageBox) {
|
||||
const div = document.createElement("div");
|
||||
const messageReply = h(MessageReply, { author: props.author?.display_name || props.author!.username, text: props.text || "", id: props.message.uuid, replyId: props.replyMessage?.uuid || element.dataset.messageId!, maxWidth: "full" });
|
||||
messageBox.prepend(div);
|
||||
render(messageReply, div);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue