fix next tick

This commit is contained in:
Chuck1sn
2025-06-04 13:21:36 +08:00
parent 27529ee70c
commit d5801b3b50
3 changed files with 13 additions and 12 deletions

View File

@@ -19,6 +19,9 @@ export default [
});
return response;
}),
http.delete("/ai/action/user", () => {
return HttpResponse.json({ success: true });
}),
http.get("/ai/llm/page-query", () => {
const generateLlm = () => ({
id: faker.number.int({ min: 1, max: 100 }),

View File

@@ -67,7 +67,7 @@
}">
</UserUpsertModal>
<UserDeleteModal :id="'user-delete-modal'" :closeModal="() => {
currentDeleteUsername = undefined
currentDeleteUsername = undefined
userDeleteModal!.hide();
}" :onSubmit="handleDeleteUserSubmit" title="确定删除该用户吗" content="删除用户"></UserDeleteModal>
<DepartmentUpsertModal :id="'department-upsert-modal'" :onSubmit="handleUpsertDepartmentSubmit" :closeModal="() => {
@@ -94,7 +94,7 @@ import type { DepartmentUpsertModel } from "@/types/department";
import DOMPurify from "dompurify";
import { Modal, type ModalInterface, initFlowbite } from "flowbite";
import { marked } from "marked";
import { nextTick, onMounted, onUnmounted, ref, watch } from "vue";
import { onMounted, onUnmounted, ref, watch } from "vue";
import { z } from "zod";
import Button from "../components/Button.vue";
import DepartmentUpsertModal from "../components/DepartmentUpsertModal.vue";
@@ -181,16 +181,12 @@ const renderMarkdown = (content: string | undefined) => {
const handleDeleteUserClick = (input: string) => {
currentDeleteUsername.value = input;
nextTick(() => {
userDeleteModal.value?.show();
});
userDeleteModal.value?.show();
};
const handleDeleteDepartmentClick = (input: string) => {
currentDeleteDepartmentName.value = input;
nextTick(() => {
departmentDeleteModal.value?.show();
});
departmentDeleteModal.value?.show();
};
const handleUpsertUserSubmit = async (data: UserUpsertSubmitModel) => {
@@ -233,8 +229,7 @@ const handleDeleteDepartmentSubmit = async () => {
watch(
messages,
async () => {
await nextTick();
() => {
scrollToBottom();
},
{ deep: true },
@@ -303,6 +298,9 @@ onMounted(async () => {
userDeleteModal.value = new Modal(
$userDeleteModalElement,
{},
{
id: "user-delete-modal",
},
);
const $departmentDeleteModalElement: HTMLElement | null =
document.querySelector("#department-delete-modal");

View File

@@ -1,6 +1,6 @@
<template>
<div :id tabindex="-1"
class="bg-gray-900/50 hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-[calc(100%-1rem)] max-h-full">
class="bg-gray-900/50 hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full h-[calc(100%-1rem)] max-h-full">
<div class="relative p-4 w-full max-w-xs sm:max-w-sm md:max-w-md max-h-full">
<div class="relative bg-white rounded-lg shadow-sm">
<button type="button" @click="closeModal"
@@ -39,7 +39,7 @@
import { initFlowbite } from "flowbite";
import { onMounted } from "vue";
defineProps<{
const { title, id, closeModal, onSubmit } = defineProps<{
title: string;
id: string;
closeModal: () => void;