1234567891011121314151617 |
- import {api} from '@/store/sync'
- import {Ref, ref} from "vue";
- const cache = new Map<string, Ref<string>>()
- export const useStaticUrl = (url) => {
- if (cache.has(url)) {
- return cache.get(url);
- } else {
- const realUrl = ref<string>()
- api.getFile(url)
- .then(data => {
- realUrl.value = data
- cache.set(url, realUrl)
- })
- return realUrl
- }
- }
|