关于vue接口的一些东西

js文件中


url: '/openOrganization/openOrgList', 对应的是接口文档那边的链接
method: 'post', 请求方式
data 数据

vue文件中


import { xxxxx } from '@/api/video-devices.js'
因为js文件中 名字就是xxxxxx 所以这里也是 xxxxx 然后路径就是 js文件的路径

然后在里面写

const fetchList = async () => {
      // 调用接口 xxxxx
      const res = await xxxxx({
        currPage: 1,
        pageSize: 100
      })
      console.log(res)
    }
onMounted(() => {
      fetchList()
    })

接口文件

vue文件中的xxxxx方法里面写接口的里面这些参数对应的返回值


暂时就这样吧

posted @ 2022-09-02 20:32  zongkm  阅读(48)  评论(0)    收藏  举报