WXS里面能发送wx.request请求给后端吗?
发布于 6 年前 作者 nding 5076 次浏览 来自 官方Issues

<wxs module=“m1”>

    var countPicture = function(postId) {

    var count = undefined;

    wx.request({

    url: 'http://localhost:8088/postBase/countPicture’,

    method: ‘post’,

    data: {

    postId:postId

    },

    header: {

    ‘content-type’: ‘application/json’

    },

    success(res) {

    count = res.data.data;

    }

    })

    return count;

    }

    module.exports.countPicture = countPicture;

</wxs>

3 回复

客官,不可以的哦

回到顶部