Añadido esperando
This commit is contained in:
@@ -1,6 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-center">
|
<div class="flex flex-center">
|
||||||
<h5 class="q-py-xl">{{ fecha }}</h5>
|
<h5 v-if="fecha == '' && !presionado" class="q-py-xl">
|
||||||
|
Cálculo de los días de riego de mis plantas
|
||||||
|
</h5>
|
||||||
|
<h5 v-else-if="presionado" class="q-py-xl">Loading...</h5>
|
||||||
|
<h5 v-else class="q-py-xl">{{ fecha }}</h5>
|
||||||
<q-btn
|
<q-btn
|
||||||
class="fixed-center"
|
class="fixed-center"
|
||||||
color="deep-orange"
|
color="deep-orange"
|
||||||
@@ -13,13 +17,18 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { date } from "quasar";
|
import { date, useQuasar } from "quasar";
|
||||||
|
|
||||||
const data = ref([]);
|
const data = ref([]);
|
||||||
const fecha = ref("");
|
const fecha = ref("");
|
||||||
const days = ref(0);
|
const days = ref(0);
|
||||||
|
const presionado = ref(false);
|
||||||
|
const $q = useQuasar();
|
||||||
const calcular = async () => {
|
const calcular = async () => {
|
||||||
|
$q.loading.show({
|
||||||
|
message: "Se está descargando la información, espere...",
|
||||||
|
});
|
||||||
|
presionado.value = true;
|
||||||
const result = fetch(
|
const result = fetch(
|
||||||
"https://api.openweathermap.org/data/2.5/forecast?lat=39.55&lon=-0.5667&units=metric&appid=1ce95ef35a6852cecee421a923fe4400"
|
"https://api.openweathermap.org/data/2.5/forecast?lat=39.55&lon=-0.5667&units=metric&appid=1ce95ef35a6852cecee421a923fe4400"
|
||||||
)
|
)
|
||||||
@@ -29,6 +38,10 @@ const calcular = async () => {
|
|||||||
})
|
})
|
||||||
.catch((err) => console.error(err));
|
.catch((err) => console.error(err));
|
||||||
data.value = await result;
|
data.value = await result;
|
||||||
|
if (data.value != []) {
|
||||||
|
$q.loading.hide();
|
||||||
|
presionado.value = false;
|
||||||
|
}
|
||||||
console.log(data.value.list);
|
console.log(data.value.list);
|
||||||
let temp = 0;
|
let temp = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user