|
|
@ -1,5 +1,6 @@ |
|
|
|
import html from "html"; |
|
|
|
import { onMounted, ref } from "vue"; |
|
|
|
import { useAppStore } from "../../store/index.js"; |
|
|
|
|
|
|
|
export default { |
|
|
|
template: html`<template v-if="name.indexOf('ep-')===0">
|
|
|
@ -19,10 +20,19 @@ export default { |
|
|
|
if (!props.name.startsWith("ep-")) { |
|
|
|
try { |
|
|
|
const url = `./assets/icons/${props.name}.svg`; |
|
|
|
navigator.locks.request(url, async () => { |
|
|
|
const appStore = useAppStore(); |
|
|
|
if (appStore.cache.has(url)) { |
|
|
|
svg.value = appStore.cache.get(url); |
|
|
|
} else { |
|
|
|
const response = await fetch(url); |
|
|
|
if (response.ok && response.status === 200) { |
|
|
|
svg.value = await response.text(); |
|
|
|
appStore.cache.set(url, svg.value); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
c; |
|
|
|
} catch (error) { |
|
|
|
console.log(error); |
|
|
|
if (!svg.value) { |
|
|
|