收藏
回答

微信云托管开发工具模拟器可以正常访问,但是体验版扫码不可以?

AppID
wx93b08af883b99530

function wxContainerRequest({ path, method = "GET", data, header = {} }) {

  // 👇 统一拼前缀,防止 // 或漏 /

  const finalPath =

    path.startsWith("/")

      ? `${BASE_PATH}${path}`

      : `${BASE_PATH}/${path}`;


  return new Promise((resolve, reject) => {

    wx.cloud.callContainer({

      config: { env: ENV_ID },

      path: finalPath,   // ✅ 统一后的路径

      method,

      data,

      header: {

        "content-type": "application/json",

        "X-WX-SERVICE": SERVICE,

        ...header,

      },

      success: resolve,

      fail: reject,

    });

  });

}


开发者工具中这样可以正常访问,上传代码后使用体验版手机扫码访问不到云托管服务

回答关注问题邀请回答
收藏

1 个回答

  • 智能回答 智能回答 本次回答由AI生成
    03-02
    有用
    回复
登录 后发表内容
问题标签