Commit 8e701459 authored by rockyl's avatar rockyl

support mask

parent 47dface0
......@@ -15,7 +15,6 @@
.poster {
position: relative;
background-color: orange;
border-radius: 2.00rem;
border: 0.1rem solid blue;
width: 5.20rem;
height: 4.40rem;
......@@ -84,5 +83,6 @@
<script src="test.js" type="module"></script>
<button id="button">截图</button>
<div id="results"></div>
</body>
</html>
......@@ -4,12 +4,16 @@
import {htmlShot} from "./dist/index.js";
const scale = window['devicePixelRatio'] || 1
async function shot() {
const result = await htmlShot(document.getElementById('poster'), {type: 'png'});
let img = new Image();
img.src = result;
img.style.width = '365px'
document.body.appendChild(img);
img.style.zoom = `${1 / scale}`
const container = document.getElementById('results')
container.appendChild(img);
}
document.getElementById('button').onclick = shot;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment