1234567891011121314151617181920212223242526272829303132333435 |
- 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<Material[] | null>((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);
- });
- };
|