不止要设置css中的cavans宽度,也要设置节点 const canvas = res.node canvas.width = 480 canvas.height = 800
使用lottie-miniprogram导入动画后,动画大小不正常?使用lottie-miniprogram,基础库2.10.4,导入动画后,设置Canvas大小后,动画大小变形,保持Canvas默认大小,就正常。 目前需要动画全屏播放,但是只有如下图大小。Canvas设置了width:100vw;height:100vh; [图片]
2022-12-23<template> <div class="content"> <img class="logo" src="~assets/images/logo.png" alt=""> <p class="text">正在打开“花生大学”微信小程序</p> <div class="open" @click="isWeixin ? open : ''">打开小程序</div> <div class="weapp" v-if="isWeixin" > <wx-open-launch-weapp username="gh_2986a360565d" path="/pages/index/index.html"> <script type="text/wxtag-template"> <style> .btn { height: 4000px; !impoartant; width: 5000px; !important; background-color: #f04146; color: #ffffff; } </style> <div class="btn">跳转小程序</div> </script> </wx-open-launch-weapp> </div> </div> </template> <script> export default { data() { return { isWeixin: false, wxData: {} } }, methods: { async wxmini(){ const res = await fetch('/clawApi/getShareConfig', { method: 'POST', headers: { 'Content-Type': 'application/json; charset=utf-8' }, body: JSON.stringify({ url: window.location.href }) }).then(response => response.json()) .then(data => { return data }); console.log(res) this.wxData = res?.data const { timestamp, appID, nonceStr, signature } = this.wxData wx.config({ // eslint-disable-line debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印 appId: appID, // 必填,公众号的唯一标识 timestamp, // 必填,生成签名的时间戳 nonceStr: nonceStr, // 必填,生成签名的随机串 signature: signature, // 必填,签名 jsApiList: ['onMenuShareTimeline'], // 必填,需要使用的JS接口列表 openTagList: ['wx-open-launch-weapp'] // 可选,需要使用的开放标签列表,例如['wx-open-launch-app'] }); /* eslint-disable */ wx.ready(function () { console.log('ready') }); } }, mounted() { const ua = navigator.userAgent.toLowerCase() const isWXWork = ua.match(/wxwork/i) == 'wxwork' this.isWeixin = !isWXWork && ua.match(/micromessenger/i) == 'micromessenger' if(this.isWeixin) { const oScript = document.createElement('script'); oScript.type = 'text/javascript'; oScript.src = 'https://res2.wx.qq.com/open/js/jweixin-1.6.0.js'; oScript.onload = this.wxmini document.body.appendChild(oScript); } }, head() { return { script: [ { src: "https://changba.com/njwap/stats/index/entry?id=1212", type: "text/javascript", charset: "utf-8" } ] } } } </script> <style lang="scss" scoped root-value="37.5"> .content { width: 375px; height: 100vh; margin: 0 auto; overflow: hidden; font-family: PingFangSC-Regular; display: flex; flex-direction: column; justify-content: center; align-items: center; position: relative; } .logo { width: 150px; height: 150px; margin-top: -50px; } .text { width: 100%; font-size: 20px; text-align: center; } .open { width: 200px; height: 50px; background-color: #f04146; margin-top: 30px; border-radius: 30px; color: #fff; font-size: 18px; display: flex; justify-content: center; align-items: center; } .weapp { position: fixed; top: 0; bottom: 0; left: 0; right: 0; z-index: 100000; font-size: 100px; overflow: hidden; opacity: 0; } </style>
vue中使用wx-open-launch-weapp?按照官方文档 https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_Open_Tag.html 配置后出现如下问题 1、vue中提示组建未注册 2、页面按钮不显示 有踩完坑的吗 分享一下经验
2021-02-26<template> <div class="content"> <img class="logo" src="~assets/images/logo.png" alt=""> <p class="text">正在打开“花生大学”微信小程序</p> <div class="open" @click="isWeixin ? open : ''">打开小程序</div> <div class="weapp" v-if="isWeixin" > <wx-open-launch-weapp username="gh_2986a360565d" path="/pages/index/index.html"> <script type="text/wxtag-template"> <style> .btn { height: 4000px; !impoartant; width: 5000px; !important; background-color: #f04146; color: #ffffff; } </style> <div class="btn">跳转小程序</div> </script> </wx-open-launch-weapp> </div> </div> </template> <script> export default { data() { return { isWeixin: false, wxData: {} } }, methods: { async wxmini(){ const res = await fetch('/clawApi/getShareConfig', { method: 'POST', headers: { 'Content-Type': 'application/json; charset=utf-8' }, body: JSON.stringify({ url: window.location.href }) }).then(response => response.json()) .then(data => { return data }); console.log(res) this.wxData = res?.data const { timestamp, appID, nonceStr, signature } = this.wxData wx.config({ // eslint-disable-line debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印 appId: appID, // 必填,公众号的唯一标识 timestamp, // 必填,生成签名的时间戳 nonceStr: nonceStr, // 必填,生成签名的随机串 signature: signature, // 必填,签名 jsApiList: ['onMenuShareTimeline'], // 必填,需要使用的JS接口列表 openTagList: ['wx-open-launch-weapp'] // 可选,需要使用的开放标签列表,例如['wx-open-launch-app'] }); /* eslint-disable */ wx.ready(function () { console.log('ready') }); } }, mounted() { const ua = navigator.userAgent.toLowerCase() const isWXWork = ua.match(/wxwork/i) == 'wxwork' this.isWeixin = !isWXWork && ua.match(/micromessenger/i) == 'micromessenger' if(this.isWeixin) { const oScript = document.createElement('script'); oScript.type = 'text/javascript'; oScript.src = 'https://res2.wx.qq.com/open/js/jweixin-1.6.0.js'; oScript.onload = this.wxmini document.body.appendChild(oScript); } }, head() { return { script: [ { src: "https://changba.com/njwap/stats/index/entry?id=1212", type: "text/javascript", charset: "utf-8" } ] } } } </script> <style lang="scss" scoped root-value="37.5"> .content { width: 375px; height: 100vh; margin: 0 auto; overflow: hidden; font-family: PingFangSC-Regular; display: flex; flex-direction: column; justify-content: center; align-items: center; position: relative; } .logo { width: 150px; height: 150px; margin-top: -50px; } .text { width: 100%; font-size: 20px; text-align: center; } .open { width: 200px; height: 50px; background-color: #f04146; margin-top: 30px; border-radius: 30px; color: #fff; font-size: 18px; display: flex; justify-content: center; align-items: center; } .weapp { position: fixed; top: 0; bottom: 0; left: 0; right: 0; z-index: 100000; font-size: 100px; overflow: hidden; opacity: 0; } </style>
报错Unknown custom element: <wx-open-launch-weapp>?在uniapp中使用h5跳转小程序,组件引用报错,说没有注册组件,我都jssdk都可以使用,有没有官方的小哥哥小姐姐解答一下????
2021-02-26