html2canvas 截图不全

478 阅读1分钟

html2canvas 官网

v-for循环出现滚动条的情况下,存在截图不全的问题

问题代码

    <div id="screenshot" style="height:60vh; overflow:auto;">
        <template v-for="item in list"></template>
    </div>

解决方法:将含有滚动条的模块外面包一层div,然后将滚动条写到新建的外面div上,截图区域不要出现滚动条。

<!-- 滚动条区域 -->
<div style="height:60vh; overflow:auto;">
    
    <!-- 截图区域 -->
    <div id="screenshot">
        <template v-for="item in list"></template>
    </div>
    
</div>