优化 canvasToPng

This commit is contained in:
icssoa
2025-07-29 13:26:31 +08:00
parent 28a6627224
commit 3b0e006ca0
8 changed files with 215 additions and 210 deletions

View File

@@ -2,8 +2,8 @@
<cl-page>
<cl-sign
ref="signRef"
:height="isFullscreen ? windowHeight - 200 : 200"
:width="windowWidth"
:fullscreen="isFullscreen"
:enable-brush="isBrush"
></cl-sign>
@@ -30,19 +30,21 @@
import { ref } from "vue";
import DemoItem from "../components/item.uvue";
const { windowWidth } = uni.getWindowInfo();
const { windowWidth, windowHeight } = uni.getWindowInfo();
const isFullscreen = ref(false);
const isBrush = ref(true);
const signRef = ref<ClSignComponentPublicInstance | null>(null);
function clear() {
signRef.value?.clear();
signRef.value!.clear();
}
function preview() {
signRef.value?.toPng().then((res) => {
console.log(res);
signRef.value!.toPng().then((url) => {
uni.previewImage({
urls: [url]
});
});
}
</script>