import { mount } from "@/utils"; import Materials from "./index.vue"; import { Material } from "@/api/material"; import { reactive } from "vue"; export const selectMaterials = async (props: { uploadFormat?: string[], format?: string[]; isSystem?: number, maxSize?: number; count?: number readonly?: boolean; groupIds?: number[] useType?: string } = {}) => { return new Promise((resolve) => { const mprops = reactive({ ...props, count: 3, visible: true, onSelectMaterials: (val: Material[]) => { resolve(val); mprops.visible = false }, "onUpdate:visible": () => { mprops.visible = false resolve(null); }, afterClose() { umMount(); } }) const umMount = mount(document.querySelector("#app")!, Materials, mprops); }); };