• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
百里丶落云
Gee,gee,baby,baby
            管理     
vue 自学笔记(6) axios的使用

前情提要:axios 的使用

    axios是一个ajax 的包,主要在node.js 使用

      axios 的官网

https://www.kancloud.cn/yunye/axios/234845

一:书写格式

          

 

     二:在cli 中下载axios 

 

       三: 在主程序mian.js中

  四:  注册使用的vue

    五:在home.vue 中使用axiso 文件

模板层

js层

 

<script>
export default {
name: "home",
data(){
return {
msg:'',
lable:''


}


},
created(){
this.$axios.get("http://wthrcdn.etouch.cn/weather_mini?city=深圳").then(response=>{
console.log(response.data);
console.log(response.data.data.ganmao);
this.lable = response.data.data.ganmao;
}).catch(error=>{

});


},

methods:{
ble(){
alert("123")

}



}


}
</script>



效果图:
  

 



 

年与时驰,意与日去,遂成枯落, 多不接世,悲守穷庐,将复何及。
posted on 2019-04-25 16:54  百里丶落云  阅读(692)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3