vue 如何获取当地的日期 以及 天气数据
第一步:npm install axios// 安装axios第二步 :在 main.js 引入//axiosimportaxiosfrom"axios";Vue.prototype.$axios=axios; //此处根据项目情况来配置第三步:在页面中调用created() {this.$axios...
·
第一步:
npm install axios // 安装axios
第二步 :
在 main.js 引入
// axios
import axios from "axios";
Vue.prototype.$axios = axios; //此处根据项目情况来配置
第三步:
在页面中调用
created() {
this.$axios
.get("http://wthrcdn.etouch.cn/weather_mini?city=郑州")
.then(function(response) {
console.log(response.data.data);
})
.catch(function(error) {
console.log(error);
});
},
end :有用的话请点个赞!转发请注明原文章地址,谢谢配合!
更多推荐
已为社区贡献5条内容
所有评论(0)