mirror of
https://github.com/MCSManager/MCSManager.git
synced 2025-01-24 15:14:01 +08:00
Optimize: code
This commit is contained in:
parent
c19ec75232
commit
3ba3d2b293
@ -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) => {
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user