]> git.immae.eu Git - github/bastienwirtz/homer.git/commitdiff
Format file.
authorDick Wolff <dckwlff@gmail.com>
Tue, 12 Jan 2021 10:39:27 +0000 (11:39 +0100)
committerDick Wolff <dckwlff@gmail.com>
Tue, 12 Jan 2021 10:39:27 +0000 (11:39 +0100)
src/components/services/OpenWeather.vue

index 30abb2d0b8c09273f47d0abf4816adb6954f3885..a9310eeac5d359527eeb71784b96c2e9ee09c24d 100644 (file)
@@ -6,7 +6,11 @@
           <div class="media">
             <div v-if="image" class="media-left">
               <figure class="image is-48x48">
-                <img :src="`http://openweathermap.org/img/wn/` + image + `@2x.png`" :alt="conditions" :title="conditions" />
+                <img
+                  :src="`http://openweathermap.org/img/wn/` + image + `@2x.png`"
+                  :alt="conditions"
+                  :title="conditions"
+                />
               </figure>
             </div>
             <div v-if="item.icon" class="media-left">
                   {{ item.subtitle }}
                 </template>
                 <template v-else-if="api">
-                  {{ temp }} 
-                                 <span v-if="this.item.units == 'metric'">&deg;C</span>
-                                 <span v-else-if="this.item.units == 'imperial'">&deg;F</span>                           
-                                 <span v-else>K</span>
+                  {{ temp }}
+                  <span v-if="this.item.units == 'metric'">&deg;C</span>
+                  <span v-else-if="this.item.units == 'imperial'">&deg;F</span>
+                  <span v-else>K</span>
                 </template>
               </p>
             </div>
@@ -47,36 +51,38 @@ export default {
   data: () => ({
     api: {
       name: "",
-         weather: [{
-               main: "",
-               description: "",
-               icon: ""
-         }],
+      weather: [
+        {
+          main: "",
+          description: "",
+          icon: "",
+        },
+      ],
       main: {
-               temp: "",
-               humidity: ""
-         }
-    }
+        temp: "",
+        humidity: "",
+      },
+    },
   }),
   computed: {
     temp: function () {
       if (this.api) {
-               return parseInt(this.api.main.temp).toFixed(1);
+        return parseInt(this.api.main.temp).toFixed(1);
+      }
+      return "";
+    },
+    image: function () {
+      if (this.api) {
+        return this.api.weather[0].icon;
+      }
+      return "";
+    },
+    conditions: function () {
+      if (this.api) {
+        return this.api.weather[0].description;
       }
       return "";
     },
-       image: function () {
-         if (this.api) {
-               return this.api.weather[0].icon;
-         }
-         return "";
-       },
-       conditions: function () {
-         if (this.api) {
-               return this.api.weather[0].description;
-         }
-         return "";
-       }
   },
   created() {
     this.fetchStatus();
@@ -96,4 +102,4 @@ export default {
 .media-left img {
   max-height: 100%;
 }
-</style>
\ No newline at end of file
+</style>