<template> <!-- 未来24小时预报 --> <div class="rainFutureHourP"> <div class="partTitleHM">未来24小时预报</div> <div class="partContHM"> <div id="rainFH"></div> </div> </div> </template> <script setup> import axios from 'axios'; const { proxy } = getCurrentInstance(); // 获取天气信息 const getWeather = () => { axios .get(`https://gfapi.mlogcn.com/weather/v001/now?key=F2hH0eoTQS99jaKr3v4AIWFQkJwRjMAU&areacode=101180801`) .then(res => { console.log(res.data); }) .catch(error => {}); }; onMounted(() => { getWeather(); }); </script> <style lang="scss" scoped> .rainFutureHourP { width: 100%; #rainFH { width: 100%; height: 200px; } } </style>