This commit is contained in:
icssoa
2025-08-02 17:17:13 +08:00
parent c606dbaea3
commit 4398574183
8 changed files with 24 additions and 68 deletions

View File

@@ -27,10 +27,9 @@ const list = ["moon-fill", "sun-fill"];
@apply bg-primary-500;
&__inner {
@apply flex flex-col;
@apply flex flex-col duration-300;
transform: translateY(20px);
transition-property: transform;
transition-duration: 300ms;
&.is-dark {
transform: translateY(-20px);

View File

@@ -142,11 +142,7 @@ function drawer() {
* @param call 回调函数,返回图片路径,失败返回空字符串
*/
function toPng(): Promise<string> {
return canvasToPng({
canvasId: qrcodeId.value,
proxy,
canvasRef: canvasRef.value!
});
return canvasToPng(canvasRef.value!);
}
// 自动重绘

View File

@@ -17,7 +17,7 @@
<script lang="ts" setup>
import { canvasToPng, parsePt, uuid } from "@/cool";
import { computed, getCurrentInstance, onMounted, ref, shallowRef, watch } from "vue";
import { computed, getCurrentInstance, nextTick, onMounted, ref, shallowRef, watch } from "vue";
defineOptions({
name: "cl-sign"
@@ -32,7 +32,7 @@ const props = defineProps({
// 画布宽度
width: {
type: Number,
default: 300
default: () => uni.getWindowInfo().windowWidth
},
// 画布高度
height: {
@@ -289,11 +289,7 @@ function clear() {
// 获取签名图片
function toPng(): Promise<string> {
return canvasToPng({
proxy,
canvasId,
canvasRef: canvasRef.value!
});
return canvasToPng(canvasRef.value!);
}
// 初始化画布
@@ -331,7 +327,9 @@ onMounted(() => {
watch(
computed(() => [props.width, props.height]),
() => {
initCanvas();
nextTick(() => {
initCanvas();
});
}
);
});