wx-open-launch-weapp 按钮显示不出来,怎么回事?
发布于 4 年前 作者 jing65 15024 次浏览 来自 官方Issues

<wx-open-launch-weapp id=“launch-btn”

                          username=“gh_1ac06b5a8f4e”

                          path="/pages/index/index?cityCode=4401&ysschannel=2019DSGZHCDL_61034_gz">

        <template>

            <style>

                .btn {

                    padding: 12px

                }

            </style>

            <button class=“btn”>打开小程序</button>

        </template>

    </wx-open-launch-weapp>

 $().ready(function () {

            var url = location.href;

            $.ajax({

                url: “…/api/UEditor/GetSignature”,//后台给你提供的接口

                data: { “url”: url },

                success: function (data) {

                    var datad = JSON.parse(data); //转译为Json字符串

                    wx.config({

                        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来

                        appId: datad.appid, // 必填,公众号的唯一标识

                        timestamp: datad.timestamp, // 必填,生成签名的时间戳

                        nonceStr: datad.noncestr, // 必填,生成签名的随机串

                        signature: datad.signature,// 必填,签名,见附录1

                        jsApiList: [“scanQRCode”], // 必填,需要使用的JS接口列表,所有JS接口列表见附录2

                        openTagList: [“wx-open-launch-weapp”]

                    });

                    wx.error(function (res) {

                        layer.msg(res);

                    });

                },

                error: function (error) {

                    layer.msg(error)

                }

            });

        })

1 回复

你好,检查下是否是因为css里面使用了定位的问题。

回到顶部