File tree Expand file tree Collapse file tree 5 files changed +31
-14
lines changed
Expand file tree Collapse file tree 5 files changed +31
-14
lines changed Original file line number Diff line number Diff line change 11<template >
2- <v-layout column class =" card" >
2+ <v-layout
3+ column
4+ class =" card"
5+ :style =" {backgroundImage:`url(${require(`@/assets/weather-icons/${dayTime}.jpg`)})`}"
6+ >
37 <v-layout row class =" card__title" >
4- <p >{{city.country ? city.country : "Текущее местоположение"}} {{city.city ? city.city : "" }}</p >
8+ <p >{{city.country}}, {{city.city}}</p >
59 </v-layout >
6- <v-layout row class =" card__center" >
10+ <v-layout row class =" card__center" align-center >
711 <v-flex xs3 >
812 <p class =" card__center_temp" >{{city.temp}}</p >
913 </v-flex >
1014 <v-flex xs6 >
1115 <div
16+ v-show =" city.WeatherIcon"
1217 class =" card__center_icon"
1318 :style =" {backgroundImage: `url(${require(`@/assets/weather-icons/${city.WeatherIcon}.png`)})`}"
1419 ></div >
1520 </v-flex >
16- <v-flex xs3 class =" card__center_wind" >
21+ <v-flex xs4 class =" card__center_wind" >
1722 <p >Направление ветра:</p >
1823 <p class =" text-md-center" >{{city.windDirect}}</p >
1924 <p >Скорость ветра:</p >
@@ -33,38 +38,47 @@ export default {
3338 components: {},
3439 props: {
3540 city: {
36- // type: String ,
41+ type: Object ,
3742 required: true
3843 }
3944 },
4045 data : () => ({
4146 url: " ~@/assets/weather-icons/01.png"
4247 }),
43- computed: {},
48+ computed: {
49+ dayTime () {
50+ return this .city .IsDayTime ? " day" : " night" ;
51+ }
52+ },
4453 created () {},
4554 mounted () {},
4655 methods: {}
4756};
4857 </script >
4958<style lang="scss" scoped>
5059.card {
51- width : 35vw ;
52- height : 45vh ;
53- background : grey ;
60+ width : 500px ;
61+ height : 250px ;
5462 margin-bottom : 5vh ;
5563 border-radius : 1em ;
64+ padding : 20px ;
5665 .card__title {
5766 margin-left : auto ;
5867 margin-right : auto ;
59- height : 4em ;
60- padding-top : 0.5em ;
68+ font-weight : 400 ;
69+ font-size : 16px ;
70+ color : white ;
6171 }
6272 .card__center {
6373 .card__center_temp {
74+ font-size : 34px ;
75+ line-height : 48px ;
76+ font-weight : 400 ;
77+ color : white ;
6478 }
6579 .card__center_icon {
66- width : 13 vw ;
67- height : 25 vh ;
80+ width : 190 px ;
81+ height : 135 px ;
6882 background-size : contain ;
6983 background-position : top ;
7084 }
Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ export default {
8888 this .selectCity = data;
8989 this .GET_WEATHER_CITY ;
9090 this .selectCityShow = false ;
91+ this .searchText = " " ;
9192 }
9293 }
9394};
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ export default {
4848 await axios . get ( url )
4949 . then ( result => {
5050 let res = result . data [ 0 ] ;
51+ // console.log(res)
5152 city = {
5253 city : data . AdministrativeArea
5354 ? data . AdministrativeArea . LocalizedName
@@ -64,7 +65,8 @@ export default {
6465 } `,
6566 weatherText : res . WeatherText ,
6667 key : res . Key ,
67- WeatherIcon : res . WeatherIcon
68+ WeatherIcon : res . WeatherIcon ,
69+ IsDayTime : res . IsDayTime
6870 } ;
6971 } ) ;
7072 commit ( 'SET_CITY' , city )
You can’t perform that action at this time.
0 commit comments