<html>
<head>
<title>打开小程序</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<script src="https://res.wx.qq.com/open/js/cloudbase/1.1.0/cloud.js"></script>
<script>
function docReady(fn) {
if (document.readyState === 'complete' || document.readyState === 'interactive') {
fn()
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
docReady(async function() {
wx.config({
debug: true, // 调试时可开启
appId: 'wx6968d4', // <!-- replace -->
timestamp: 1683808786, // 必填,填任意数字即可
nonceStr: 'nonceStr', // 必填,填任意非空字符串即可
signature: 'a26e688cb388af13a597e82', // 必填,填任意非空字符串即可
jsApiList: ['chooseImage', 'previewImage'], // 必填,随意一个接口即可
openTagList:['wx-open-launch-weapp'], // 填入打开小程序的开放标签名
});
})
</script>
</head>
<body>
<div>
--
<div border="1px solid #000;">
<wx-open-launch-weapp id="launch-btn" username="gh_002f7a0a0574" path="pages/center/index">
<template>
123123
<button style="width: 200px; height: 45px; text-align: center; font-size: 17px; display: block; margin: 0 auto; padding: 8px 24px; border: none; border-radius: 4px; background-color: #07c160; color:#fff;">
打开小程序
</button>
</template>
</wx-open-launch-weapp>
</div>
sdfsadfsadfsd
--
<wx-open-launch-weapp id="launch-btn" username="gh_002f7a0a0574" path="pages/home/index">
<template>
123123
<button style="width: 200px; height: 45px; text-align: center; font-size: 17px; display: block; margin: 0 auto; padding: 8px 24px; border: none; border-radius: 4px; background-color: #07c160; color:#fff;">
打开小程序
</button>
</template>
</wx-open-launch-weapp>
</div>
<wx-open-launch-weapp id="launch-btn" username="gh_002f7a0a0574" path="pages/home/index">
<template>
123123
<button style="width: 200px; height: 45px; text-align: center; font-size: 17px; display: block; margin: 0 auto; padding: 8px 24px; border: none; border-radius: 4px; background-color: #07c160; color:#fff;">
打开小程序
</button>
</template>
</wx-open-launch-weapp>
</div>
</div>
</body>
</html>
官方文档:
目录 | 微信开放文档https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_Open_Tag.html#21