Icon caching
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import Loading from '@/components/Loading.vue';
|
||||
import {inject, onMounted, ref} from 'vue';
|
||||
import {api} from '../services/api';
|
||||
import {api, BASE} from '../services/api';
|
||||
|
||||
const data = ref<any>();
|
||||
const openGraph = inject<(key: string) => void>('openGraph');
|
||||
@@ -80,7 +80,7 @@ onMounted(async () => {
|
||||
<div class="flex-r align-items-center justify-between">
|
||||
<div v-if="!data" class="pos-rel br-2 overflow-hidden" style="width: 75px; height: 50px"><Loading/></div>
|
||||
<div v-else class="flex-c justify-center align-items-center mx-3">
|
||||
<img :src="'https://openweathermap.org/img/wn/' + data.icon + '@2x.png'" class="today-icon" alt="weather" />
|
||||
<img :src="BASE + '/api/icon/' + data.icon" class="today-icon" alt="weather" />
|
||||
<div class="today-label">{{ data.label }}</div>
|
||||
</div>
|
||||
<div class="flex-r align-items-center gap-2">
|
||||
|
||||
@@ -67,7 +67,7 @@ onMounted(async () => {
|
||||
<div v-if="days?.length" class="strip">
|
||||
<div v-for="d in days" class="day">
|
||||
<div class="day-name">{{ formatDate('ddd, MMM D', d.time) }}</div>
|
||||
<img :src="BASE + d.icon" class="day-icon" :alt="(d.label?.toString() || '')" />
|
||||
<img :src="BASE + '/api/icon/' + d.icon" class="day-icon" :alt="(d.label?.toString() || '')" />
|
||||
<div class="day-label">{{ d.label }}</div>
|
||||
<div class="day-temps">
|
||||
<span>↑{{ ~~(d.temperature_max) + '°' || '—' }}</span>
|
||||
|
||||
@@ -87,7 +87,7 @@ onMounted(async () => {
|
||||
<template v-if="hours?.length">
|
||||
<div v-for="h in hours" class="hour-row">
|
||||
<span class="hour-time">{{ formatDate('h A', h.time) }}</span>
|
||||
<img :src="BASE + h.icon" class="hour-icon" :alt="h.label?.toString() || ''" />
|
||||
<img :src="BASE + '/api/icon/' + h.icon" class="hour-icon" :alt="h.label?.toString() || ''" />
|
||||
<span class="hour-label">{{ h.label }}</span>
|
||||
<div class="hour-meta">
|
||||
<span>🌧️ {{ (h.precipitation as any || 0).toFixed(1) }}mm</span>
|
||||
|
||||
Reference in New Issue
Block a user