Optimize: code

This commit is contained in:
Lazy 2023-10-17 19:58:30 +08:00
parent c19ec75232
commit 3ba3d2b293
3 changed files with 9 additions and 15 deletions

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { ref, onMounted, computed } from "vue";
import type { UserInstance } from "@/types";
import type { UserInstance, MountComponent } from "@/types";
import { t } from "@/lang/i18n";
import {
SearchOutlined,
@ -17,10 +17,7 @@ import { message } from "ant-design-vue";
import { computeNodeName } from "../tools/nodes";
import { throttle } from "lodash";
const props = defineProps<{
destroyComponent: Function;
emitResult: Function;
}>();
const props = defineProps<MountComponent>();
const open = ref(false);
@ -104,8 +101,8 @@ const selectItem = (item: UserInstance) => {
selectedItems.value.push(item);
};
const findItem = (record: UserInstance) => {
return selectedItems.value.some((item) => JSON.stringify(item) === JSON.stringify(record));
const findItem = (item: UserInstance) => {
return selectedItems.value.some((i) => JSON.stringify(i) === JSON.stringify(item));
};
const removeItem = (item: UserInstance) => {

View File

@ -12,8 +12,6 @@ export function useMountComponent() {
const app = createApp(component, {
async destroyComponent(delay = 0) {
console.log(delay);
await sleep(delay);
app.unmount();
div.remove();

View File

@ -99,17 +99,11 @@ export interface UserInfo {
}
export interface UserInstance {
// endTime: string;
hostIp: string;
// ie: string;
instanceUuid: string;
// lastDatetime: string;
nickname: string;
// oe: string;
// remarks: string;
serviceUuid: string;
status: number;
// stopCommand: string;
}
export interface ImageInfo {
@ -185,3 +179,8 @@ export interface QuickStartTemplate {
author: string;
targetLink: string;
}
export interface MountComponent {
destroyComponent: Function;
emitResult: Function;
}