feat:对接首页数据
This commit is contained in:
@@ -27,11 +27,11 @@
|
||||
</li>
|
||||
</ul>
|
||||
<div class="weather">
|
||||
<span>25˚C-晴</span>
|
||||
<span>{{ weatherData?.temperature }}-{{ weatherData?.skycon }}</span>
|
||||
<span class="line">|</span>
|
||||
<span>风速:A2-4级</span>
|
||||
<span>风速:{{ weatherData?.windSpeed }}</span>
|
||||
<span class="line">|</span>
|
||||
<span>空气质量:A2-优</span>
|
||||
<span>空气质量:{{ weatherData?.airQuality }}</span>
|
||||
<span class="ml-20">{{ currentDate }}</span>
|
||||
</div>
|
||||
<div v-if="isBack" class="back" @click="handleBack">
|
||||
@@ -45,6 +45,8 @@
|
||||
import title2 from '@/assets/images/title-2.png'
|
||||
import title2Select from '@/assets/images/title-2-select.png'
|
||||
|
||||
import { getWeatherApi } from '@/api/home'
|
||||
|
||||
let props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
@@ -74,6 +76,7 @@
|
||||
const emit = defineEmits(['change'])
|
||||
const router = useRouter()
|
||||
let currentDate = ref('')
|
||||
let weatherData = ref({})
|
||||
|
||||
const name = computed(() => {
|
||||
if (!props.isSkip && props.navLeft.length > 0) {
|
||||
@@ -108,7 +111,13 @@
|
||||
emit('on-change', index)
|
||||
}
|
||||
}
|
||||
const getWeather = async () => {
|
||||
let res = await getWeatherApi()
|
||||
weatherData.value = res.data
|
||||
console.log(res, '====')
|
||||
}
|
||||
onMounted(() => {
|
||||
getWeather()
|
||||
getCurrentDate()
|
||||
setInterval(() => {
|
||||
getCurrentDate()
|
||||
|
||||
Reference in New Issue
Block a user