mirror of
https://github.com/web3privacy/web
synced 2024-10-15 18:26:27 +02:00
update
This commit is contained in:
parent
2609058040
commit
a829346c35
1 changed files with 7 additions and 2 deletions
|
@ -63,6 +63,7 @@ onMount(() => {
|
||||||
const img = searchParams.get('img');
|
const img = searchParams.get('img');
|
||||||
if (img) {
|
if (img) {
|
||||||
imageSelected.set(img);
|
imageSelected.set(img);
|
||||||
|
updateImages();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -97,19 +98,23 @@ const tools = {
|
||||||
|
|
||||||
let imagesSrc = import.meta.glob("../../public/gen-img/events/*.png");
|
let imagesSrc = import.meta.glob("../../public/gen-img/events/*.png");
|
||||||
const images = [];
|
const images = [];
|
||||||
|
const dImages = {};
|
||||||
for (const path in imagesSrc) {
|
for (const path in imagesSrc) {
|
||||||
const splitted = path.split('/')
|
const splitted = path.split('/')
|
||||||
const ph = splitted[splitted.length-1].split('.')[0];
|
const ph = splitted[splitted.length-1].split('.')[0];
|
||||||
images.push(ph);
|
images.push(ph);
|
||||||
|
dImages[ph] = import(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//console.log(dImages);
|
||||||
|
|
||||||
const deepImgSrc = writable(null);
|
const deepImgSrc = writable(null);
|
||||||
async function updateImages () {
|
async function updateImages () {
|
||||||
|
|
||||||
const col = {};
|
const col = {};
|
||||||
for (const imgFn of images) {
|
for (const imgFn of images) {
|
||||||
const id = getImageUrl(imgFn)
|
const id = getImageUrl(imgFn)
|
||||||
let imgClass = await import("../../public"+id);
|
let imgClass = await dImages[imgFn];
|
||||||
const i = imgClass.default;
|
const i = imgClass.default;
|
||||||
i.ratio = i.width / i.height;
|
i.ratio = i.width / i.height;
|
||||||
col[id] = i;
|
col[id] = i;
|
||||||
|
@ -117,7 +122,7 @@ async function updateImages () {
|
||||||
deepImgSrc.set(col);
|
deepImgSrc.set(col);
|
||||||
}
|
}
|
||||||
onMount(updateImages);
|
onMount(updateImages);
|
||||||
afterUpdate(updateImages);
|
//afterUpdate(updateImages);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue