Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

WeChat Mini Programs launched snapshot to generate posters, eliminating the need to draw canvases manually.

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > IT Information >

Share

Shulou(Shulou.com)11/24 Report--

CTOnews.com Sept. 14 news, partners who have produced WeChat Mini Programs's poster function know that this function is generally achieved through canvas canvas drawing and server rendering, but they all need to be scripted manually, and it is not very convenient to make them.

In order to meet the needs of Mini Program to generate posters efficiently, Wechat announced the introduction of snapshot components in the Skyline rendering engine to quickly solve complex typesetting, super-long posters and other difficult problems.

According to reports, compared with the existing ways of canvas rendering and server-side rendering, snapshot components have the following advantages:

Easy to deal with complex typesetting, such as rounded corners, percentages, custom fonts and other styles can be easily adjusted

No width and height limit, support the output of super-long posters

The calling method is simple, and it is directly realized by using wxml.

The ▲ snapshot component generates the poster and saves it locally. The source is the official account of "Wechat developer". In addition, the complete process of generating Mini Program poster and saving the local image through the snapshot component is also very simple:

Use wxml to draw poster content

Use the snapshot component to wrap the poster's wxml

Call takeSnapshot to get picture data

Call fs.writeFileSync to write poster data to a local file

Call wx.saveImageToPhotosAlbum to save the poster locally

In other words, users can use wxml to write poster layout like Mini Program UI, and then directly fill in dynamic data, which is much easier to use, and interested CTOnews.com partners can try it in the project.

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.

Share To

IT Information

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report