美文网首页
axios请求get无法传参数

axios请求get无法传参数

作者: 回忆不死我们不散 | 来源:发表于2019-11-01 09:06 被阅读0次
    接口函数.png 调取接口.png

    js

    import axios from 'axios'
    import qs from 'qs'
    
    
    //export const BASE_URL = 'http://www.gczzz.cn/website'
    //export const BASE_URL = 'https://www.apiopen.top/'
    //export const BASE_URL = '/api'
    //export const BASE_URL = ''
    
    
    // 首页api
    // 单位列表
    export const dwgllist = params => axios.post('/smp-ghg/EnterpConfMerge/getEnterpConfMergeList',qs.stringify(params))
    
    // 单位列表
    export const dwname = params => axios.get('/smp-ghg/bulletin/getBulletinByEnterpId',params)
    // 举例01
    export const getUserProductList = params => axios({
        url: BASE_URL + '/product/product_select',
        method: 'POST',
        headers: {
            'userid':sessionStorage.getItem('userid')
        },
        data:params
    })
    
    

    vue界面

    mounted(){
          this.dwgllist0(this.currentPage4,18,this.value1,this.value,this.value2)
          this.dwname0({enterpId:1});
        }
    
    //单位列表
          async dwgllist0(dwpage,dwsize,dwtiem,dwproper,dwinteger) {
            const result = await dwgllist({
              pageNum:dwpage,pageSize:2,createTime:dwtiem,property:dwproper,isImportant:dwinteger
            });
            if (result.data.code === this.$store.state.codes) {
              this.dwsj=result.data.enterpConfMergeList.list
              console.log(result)
            }
          },
    
          //单位列表
          async dwname0(params) {
            const result = await dwname({params});
            if (result.data.code === this.$store.state.codes) {
              console.log(result,'0000000')
            }
          },
    

    相关文章

      网友评论

          本文标题:axios请求get无法传参数

          本文链接:https://www.haomeiwen.com/subject/qbzxbctx.html