thebabypiggy
V2EX  ›  微信

在微信小程序中调用 http,调试时一片空白,代码如下

  •  
  •   thebabypiggy · Mar 9, 2018 · 1953 views
    This topic created in 3014 days ago, the information mentioned may be changed or developed.
    Page({
    data:{
    feedback: []
    },
    onload:function() {
    wx.showToast({
    title: '加载中',
    icon: 'loading',
    duration: 1000
    });
    wx.request({
    url: 'https://www.baidu.com', //仅为示例,并非真实的接口地址
    data: { },
    header: {
    'content-type': 'application/json' // 默认值
    },
    success: function (res) {
    console.log(res.data)
    }
    })


    }


    });
    heybuddy
        1
    heybuddy  
       Mar 10, 2018 via Android
    你得确任你关闭了开发模式下的域名合法性校验或者把域名配置都到合法域名里
    thebabypiggy
        2
    thebabypiggy  
    OP
       Mar 10, 2018 via iPhone
    @heybuddy 我两个都做了,然而依旧是只显示一个加载中,然后就是空白页面
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4675 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 00:13 · PVG 08:13 · LAX 17:13 · JFK 20:13
    ♥ Do have faith in what you're doing.