小程序canvas組件層級過高問題的解決方法


HTML:

<canvas canvas-id="canvasLine" v-show="!charImg" id="canvasLine" class="charts" disable-scroll="true" @touchstart="touchLine"
@touchmove="moveLine" @touchend="touchEndLine"></canvas>
<!-- image用來解決canvas組件層級過高問題 -->
<image v-if="charImg" :src="charImg" class="charts"></image>

Vue方法:

// 解決canvas層級過高,遮擋彈出層的問題;參考:https://blog.csdn.net/liya_nan/article/details/82023761
            handleCanvarToImg(that) {
                uni.canvasToTempFilePath({
                    x: 0,
                    y: 0,
                    width: uni.upx2px(702),
                    height: uni.upx2px(544),
                    canvasId: 'canvasLine',
                    success: function(res) {
                        that.charImg = res.tempFilePath;
                        // console.log('that.charImg',that.charImg);
                    }
                });
                
            }

參考:

https://blog.csdn.net/liya_nan/article/details/82023761


免責聲明!

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



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