首页 > 移动平台 > 详细

vue axios

时间:2020-11-14 22:50:05      阅读:41      评论:0      收藏:0      [点我收藏+]

简单示例

"dependencies": {
    "axios": "^0.18.0",
    "element-ui": "^2.4.11",
    "js-cookie": "^2.2.0",
    "vue": "^2.5.2",
    "vue-router": "^3.0.1"
  },

 

devDependencies
"mockjs": "^1.0.1-beta3",

<script>
import axios from axios
import mock from @/mock/mock.js
export default {
  name: Home,
  methods: {
    testAxios() {
      axios.get(http://localhost:8080).then(res => { alert(res.data) })
    },
    getUser() {
      axios.get(http://localhost:8080/user).then(res => { alert(JSON.stringify(res.data)) })
    },
    getMenu() {
      axios.get(http://localhost:8080/menu).then(res => { alert(JSON.stringify(res.data)) })
    }
  }
}
</script>

 

vue axios

原文:https://www.cnblogs.com/perfei/p/13974451.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!