刚入职,没用学过接口,vue等前段知识,现在对接口,这个是一张图,数据审核完成,根据后台提供的数据接口在这里显示说在里写接口,我很盟, 这是接口,我想知道怎么调用那位大神讲一下接口,在那些调用,有没有视频,或讲解的,我在网上找得不一样啊
getChannelById 这个方法里 return axios 是一个 promise 对象。建议你可以了解一下axios库 和 promise你可以import {getChannelById} from 'api/xxx.js' 然后使用 async/await 或者 then(res => {}) 方式 比如:xxx.vuemethods:{ async getData1(){ try{ const data = await getChannelById(params) // data 就是接口返回的数据 }catch(err){ console.log(err) } }, // 或者 getData2(){ getChannelById(params).then(res => { // res 就是接口返回的数据 }).catch(err => { console.log(err) }) } }
getChannelById
这个方法里return axios
是一个promise
对象。建议你可以了解一下axios库
和promise
你可以
import {getChannelById} from 'api/xxx.js'
然后使用
async/await
或者then(res => {})
方式比如:
xxx.vue