1、微信公众平台(后台登录页):https://mp.weixin.qq.com/
2、微信小程序官网文档(组件+api等):https://developers.weixin.qq.com/miniprogram/dev/component/audio.html
3、微信开放社区(问题社区):https://developers.weixin.qq.com/community/develop/question
4、vant小程序组件库:https://vant-contrib.gitee.io/vant-weapp/#/home
一、开发中遇到的问题&解决
如何在小程序中打开h5页面?
答:通过使用小程序web-view组件来显示h5页面。前提:(1)h5页面所在的域名必须是https。(2)在微信后台,将https域名,配置到业务域名下(开发 -》 开发管理 -》开发设置 -》业务域名-》先下载校验文件xx.txt放置到页面域名的根目录下)-》添加域名即可。
点击跳转的页面xx.js:
// 查看营业执照信息viewLicenseH5Page(){// 特殊处理:需要将http的页面修改为https域名访问。const httpsUrl = this.data.certificate_link.replace(/http:/, "https:")wx.navigateTo({url: `/pages/webView/index?url=${encodeURIComponent(httpsUrl)}`})},
webview目录:
index.wxml页面代码如下:
<view><web-view src="{{h5Url}}" binderror="webViewError" bindload="webViewSuccess" bindmessage="webViewMess" />
</view>
index.js代码如下:
Page({data:{h5Url: '', // web-view地址},onLoad(options){this.setData({courseUrl: decodeURIComponent(options.url)})},// web-view加载错误回调webViewError(){console.log('webview加载失败');},// web-view加载成功webViewSuccess(e){// console.log('e--',e);},// web-view接收网页信息webViewMess(e){console.log('webViewMess',e);}
})