vue 自学笔记(6) axios的使用

前情提要:axios 的使用vue

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

      axios 的官网ios

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

一:书写格式axios

          

 

     二:在cli 中下载axios this

 

       三: 在主程序mian.js中spa

  四:  注册使用的vuecdn

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

模板层ip

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>



效果图:
  

相关文章
相关标签/搜索