上条博客已经介绍了如何云调用生成小程序码,链接地址:
https://blog.csdn.net/mingjuna2010/article/details/92796711
这条博客我们来介绍小程序中怎么生成长图,如何预览,并且在长图中绘制小程序码,以及小程序码中间的默认logo换成自定义logo。
①首先在页面上 index.wxml 准备一个画布,画布的宽度设定,高度不定。由于高度不定,所以预览时画布是不显示在页面上的,只提供画图功能,显示在页面上的是image标签,外层使用swiper-view,进行长图的上下滑动预览,视觉效果加上蒙层,代码如下:
<!-- 显示在页面上的image标签,即长图 -->
<scroll-view class="temp_day_box" style='max-height:900rpx;' scroll-y wx:if="{
{sharing}}">
<view>
<image class="canvas_img" style='height:{
{height*2}}rpx' src='{
{shareImgSrc}}'></image>
</view>
</scroll-view>
<!--显示长图是背景变暗,即蒙层-->
<view class="mask" catchtap='shareStop' catchtouch