npm install axios --save
import { createApp } from 'vue'
import axios from 'axios'
import VueAxios from 'vue-axios'
const app = createApp(App)
app.config.globalProperties.$http = axios;
app.use(VueAxios, axios)
{
"data":{
"sucess":200,
"userList":[
{
"success":200,
"name":"王三",
"key":0,
"age":21,
"address":"海珠区琶洲会展中心"
},
{
"success":200,
"name":"李五",
"key":1,
"age":32,
"address":"海珠区花城大道北109号"
},
{
"success":200,
"name":"嘎子哥",
"key":2,
"age":37,
"address":"深圳市宝安区宝钢大道999号"
},
{
"success":200,
"name":"红豆",
"key":3,
"age":24,
"address":"阳江市小岗村101号"
},
{
"success":200,
"name":"大娟",
"key":4,
"age":30,
"address":"河源市白云大道"
},
{
"success":200,
"name":"嘎子哥",
"key":4,
"age":37,
"address":"深圳市宝安区宝钢大道999号"
},
{
"success":200,
"name":"红豆",
"key":6,
"age":24,
"address":"阳江市小岗村101号"
},
{
"success":200,
"name":"大娟",
"key":7,
"age":30,
"address":"河源市白云大道"
},
{
"success":200,
"name":"嘎子哥",
"key":8,
"age":37,
"address":"深圳市宝安区宝钢大道999号"
},
{
"success":200,
"name":"红豆",
"key":9,
"age":24,
"address":"阳江市小岗村101号"
},
{
"success":200,
"name":"大娟",
"key":10,
"age":30,
"address":"河源市白云大道"
}
]
}
}
import axios from 'axios'
6.效果图