1.import导入方法
import {fetchList} from '@/api/shumei';
import {formatDate} from "@/utils/index.js"//时间格式
2.create 创建
created(){
this.getList()
},
3.getlist方法实现接口
getList(){
let obj={'page':this.queryList.current,'shike.im':'"//接口地址"'},me=this
fetchList(obj).then(res=>{
if(res.status==200){
me.tableData=res.data.lists
me.total=res.data.total
for(let j of me.tableData){
j['timestamp']=j['data']['timestamp']?formatDate(j['data']['timestamp']):''//时间戳
j['name']=j['member']?j['member']['name']:''//这里name是在member数组里的,要取
}
}
})
}
4.调试,network ->xhr and fetch