http/api/文件名字.js 里面填
export const geXXX = (data) => http.post('接口路径',data)
接口调用页面方法
//as 后面的service名字可以随意取
import * as service from '@/http/+接口的本地路径'
service.getXXX({
//根据后端要求进行传值(注意数据类型)
pageNo: 123
}).then(res => {
//打印日志
console.log('XXX接口', res)
this.XXX = res.xxx
})
添加接口:
if (res.success) {
this.XXX = this.nameStudio
}