• ADADADADAD

    h5页面如何连接小程序[ 建站问答 ]

    建站问答 时间:2024-12-01 19:14:56

    作者:文/会员上传

    简介:

    在h5页面中连接小程序的方法1.首先,在小程序页面内嵌h5网页;<view class="page-body"><web-view src="https://xxx.com/test.html"></web-view></view>2.在h5网页中引入json文

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

    在h5页面中连接小程序的方法

    1.首先,在小程序页面内嵌h5网页;

    <view class="page-body">
    <web-view src="https://xxx.com/test.html"></web-view>
    </view>

    2.在h5网页中引入json文件,并调用wx.miniProgram.navigateTo方法连接小程序;

    <!DOCTYPEhtml>

    <html>

    <head>

    <metacharset="UTF-8">

    <title>h5跳转小程序</title>

    </head>

    <body>

    <h3align="center">正在跳转到小程序...</h3>

    <scripttype="text/javascript"src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>

    <script>

    wx.miniProgram.navigateTo({url:'/index/index?phone=18012121212'})

    </script>

    </body>

    </html>

    3.最后,在小程序页面接受h5页面的参数,即可;

    <viewclass="page-body">

    {{phone}}

    </view>

    index.json

    Page({

    data:{

    phone:''

    },

    onLoad:function(options){

    varthat=this;

    /*获取参数*/

    varphone=options.phone

    that.setData({

    phone:phone,

    })

    }

    })

    h5页面如何连接小程序.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: 小程序h5