getWeatherFun() { $.getJSON('https://tianqiapi.com/api?version=v1&appid=API号&appsecret=KcsRCM8w&vue=1').then((value) => { // console.log(value, '天气对') this.weatherTopData = value.city this.weaterCenterData1 = value.data[0].tem this.weaterCenterData2 = value.data[0].wea this.weaterCenterData3 = value.data[0].win_speed this.forData = value.data value.data.filter(val => { // 天气图标 if (val.wea_img === 'yu') { this.weaterImg = require('../../assets/cockpit/15.png') } else if (val.wea_img === 'qing') { this.weaterImg = require('../../assets/cockpit/8.png') } else if (val.wea_img === 'xue') { this.weaterImg = require('../../assets/cockpit/15.png') } else if (val.wea_img === 'xue') { this.weaterImg = require('../../assets/cockpit/25.png') } }) }).catch(value => { console.log(value, '天气错') }) }