refactor: improve signature component resize handling

This commit is contained in:
weichengwu 2025-11-27 16:47:56 +08:00
parent 30695c234d
commit 6b6a7ada79
1 changed files with 11 additions and 3 deletions

View File

@ -57,7 +57,7 @@
</div>
</template>
<script setup>
import { ref, onMounted, computed, onUnmounted, watch } from "vue";
import { ref, onMounted, computed, onUnmounted, watch, nextTick } from "vue";
import { useRouter, useRoute } from "vue-router";
import { Local } from "@/utils/storage.js";
import { receiveCode } from "@/api/index.js";
@ -126,6 +126,10 @@ function getSignatureHeight() {
);
if (content) {
content.style.height = `${signatureHeight}px`;
nextTick(() => {
var _a;
(_a = vanSignatureRef.value) == null ? void 0 : _a.resize();
});
}
}
}, 100);
@ -201,6 +205,10 @@ function updateGridSize() {
size = Math.min(size, availableWidth);
gridSize.value = size;
}
function handleResize() {
updateGridSize();
getSignatureHeight();
}
onMounted(() => {
//
setTimeout(() => {
@ -216,10 +224,10 @@ onMounted(() => {
receiveName.value = marriageInfo.receiveName;
}
}
window.addEventListener("resize", updateGridSize);
window.addEventListener("resize", handleResize);
});
onUnmounted(() => {
window.removeEventListener("resize", updateGridSize);
window.removeEventListener("resize", handleResize);
});
watch(nameChars, () => {
updateGridSize();