Feat: effect used style
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import type { App, Component, DefineComponent } from "vue";
|
||||
|
||||
import { getCurrentInstance } from "vue";
|
||||
|
||||
export const cards = {} as Record<string, Component>;
|
||||
|
||||
export async function compileCards(app: App<any>) {
|
||||
const svgs = import.meta.glob("@/assets/images/cards/heron-svg/*.svg", {
|
||||
eager: true,
|
||||
});
|
||||
|
||||
// const components = await Promise.all(
|
||||
// Object.entries(svgs).map(async ([k, v]) => {
|
||||
// const regex = /([\d]+)(?=\.svg)/gm;
|
||||
// const url = (v as any).default as string;
|
||||
// let template = await (await fetch(url)).text();
|
||||
// let arrayTemplate = template.split("\n");
|
||||
// arrayTemplate.splice(0, 1);
|
||||
// template = arrayTemplate.join("\n");
|
||||
|
||||
// return [
|
||||
// k.match(regex)![0],
|
||||
// defineComponent({
|
||||
// props: ["currentTurn", "card"],
|
||||
// setup(_props) {
|
||||
// const count = ref(0);
|
||||
// return { count };
|
||||
// },
|
||||
// template: template,
|
||||
// }),
|
||||
// ];
|
||||
// })
|
||||
// );
|
||||
|
||||
const components = await Promise.all(
|
||||
Object.entries(svgs).map(async ([k, v]) => {
|
||||
const regex = /([\d]+)(?=\.svg)/gm;
|
||||
const url = (v as any).default as string;
|
||||
let template = await (await fetch(url)).text();
|
||||
let arrayTemplate = template.split("\n");
|
||||
arrayTemplate.splice(0, 1);
|
||||
template = arrayTemplate.join("\n");
|
||||
|
||||
return [
|
||||
Number(k.match(regex)![0]).toString(),
|
||||
markRaw(
|
||||
defineAsyncComponent({
|
||||
loader: async () => ({
|
||||
props: ["used_effects_indexes", "card"],
|
||||
template: template,
|
||||
}),
|
||||
})
|
||||
),
|
||||
];
|
||||
})
|
||||
);
|
||||
|
||||
Object.assign(cards, Object.fromEntries(components));
|
||||
}
|
||||
Reference in New Issue
Block a user