In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to set the size of WeChat Mini Programs canvas". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
WeChat Mini Programs's size setting can be marked with rpx, and the same class as rem can be adaptively compatible with WeChat Mini Programs to convert different model sizes.
However, in Mini Program canvas, the size conversion will be invalid (due to the lag of painting), so you need to calculate the canvas size adaptively.
one。 The solution uses the getSystemInfo provided by Mini Program to obtain the system information of the current device, and converts the canvas size that needs to be set by obtaining the current device size, so that canvas drawing can be applied to all devices.
Wx.getSystemInfo (OBJECT)
Sample code:
Wx.getSystemInfo ({success: function (res) {console.log (res.model) console.log (res.pixelRatio) console.log (res.windowWidth) console.log (res.windowHeight) console.log (res.language) console.log (res.version) console.log (res.platform)}) II. The calculation example gets the canvas size required for dynamic conversion of the width and height of the current window
Wx.getSystemInfo ({/ / obtain system information successfully, assign the width and height of the system window to the width and height of the page success: function (res) {that.width = res.windowWidththat.height = res.windowHeightthat.radius = 105602 * that.height}}) "how to set the size of WeChat Mini Programs canvas" is introduced here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.