微信內h5頁面打開小程序【詳細教程】


相關配置

  1. 微信js文件版本大於等於1.6.0
    https://res.wx.qq.com/open/js/jweixin-1.6.0.js
  2. 微信授權配置

    window.wx.config({
     ...otherConfig,
     openTagList: ['wx-open-launch-weapp']
    })
  3. 調用示例

    const style = {
      position: 'absolute',
      top: 0,
      right: 0,
      bottom: 0,
      left: 0,
    };
    
    function OpenWeapp({ originId, pagePath }) {
      return (
     <wx-open-launch-weapp username={originId} path={pagePath} style={style}>
       <script type="text/wxtag-template">
         <div style={style} />
       </script>
     </wx-open-launch-weapp>
      );
    }
    
    // 使用方式
    <div style={{ position: 'relative' }}>
    點擊跳轉小程序
    <OpenWeapp originId="gh_xxxxxxxx" pagePath="pages/home/index?user=123&action=abc" />
    </div>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM