一、vue中可以用axios来做接口
二、使用步骤
(1)axios的安装
npm install axios
--save
(2)在main.js中引入
import axios from 'axios'
(3)在vue文件中也要引入
<script>
import axios from 'axios';
mounted: function() {
axios
.get('url接口地址&limit=5&offset=0&order=desc')
.then(response => (this.list1 =response.data.rows))
.catch(function(error) {
// 请求失败处理
console.log(error);
});
}
</script>