From 8fd16a99d8040d7774c9b137fff0565cdd2e0b09 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Sat, 08 May 2021 15:10:42 +0800
Subject: [PATCH] 天气
---
public/weather/index.html | 45 ++++++++++++++++++++++++---------------------
1 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/public/weather/index.html b/public/weather/index.html
index 9c8ab03..b4ee95b 100644
--- a/public/weather/index.html
+++ b/public/weather/index.html
@@ -20,6 +20,8 @@
display: flex;
align-items: center;
justify-content: center;
+ position: relative;
+right: -20px;
}
.time {
@@ -30,7 +32,7 @@
</head>
<body>
- <div id="weather" v-if="begin">
+ <div id="weather">
<span class="time">
{{nowTime.year}}年{{nowTime.month}}月{{nowTime.day}}日 {{nowTime.hour}}:{{nowTime.minute}}:{{nowTime.second}}
</span>
@@ -69,33 +71,34 @@
this.nowTime.minute = (new Date()).getMinutes() < 10 ? '0' + (new Date()).getMinutes() : (new Date()).getMinutes();
this.nowTime.second = (new Date()).getSeconds() < 10 ? '0' + (new Date()).getSeconds() : (new Date()).getSeconds();
},
- getWeather() {
- var that = this;
- // var url = `http://wthrcdn.etouch.cn/weather_mini?city=${this.city}`
- var url = `https://web.byisf.com/weatherGet/weather_mini?city=${this.city}`
- axios.get(url).then((res) => {
- var data = res.data.data,
- nowDay = data.forecast[0];
- that.weathers.nowWeather = nowDay.type;
- that.weathers.highTemperature = nowDay.high.slice(3);
- that.weathers.lowTemperature = nowDay.low.slice(3);
- that.begin = true;
- })
- },
- getCity() {
- var ctiyName = returnCitySN["cname"];
- console.log(ctiyName, 4343543);
- this.city = '南昌'
- this.getWeather();
- }
+ // getWeather() {
+ // var that = this;
+ // // var url = `http://wthrcdn.etouch.cn/weather_mini?city=${this.city}`
+ // var url = `https://web.byisf.com/weatherGet/weather_mini?city=${this.city}`
+ // axios.get(url).then((res) => {
+ // var data = res.data.data,
+ // nowDay = data.forecast[0];
+ // that.weathers.nowWeather = nowDay.type;
+ // that.weathers.highTemperature = nowDay.high.slice(3);
+ // that.weathers.lowTemperature = nowDay.low.slice(3);
+ // that.begin = true;
+ // })
+ // },
+ // getCity() {
+ // var ctiyName = returnCitySN["cname"];
+ // console.log(ctiyName, 4343543);
+ // this.city = '南昌'
+ // this.getWeather();
+ // }
},
mounted() {
this.getNewTime();
setInterval(() => {
this.getNewTime();
}, 1000);
+ // this.begin = true;
// this.getWeather();
- this.getCity();
+ // this.getCity();
}
})
</script>
--
Gitblit v1.9.3