-
+
@@ -80,15 +80,13 @@ module.exports = {
}
},
mounted() {
- const innerWidth = window.innerWidth
- const innerHeight = window.innerHeight
-
- const canvas = document.getElementById("canvas")
- canvas.width = window.innerWidth
- canvas.height = window.innerHeight
+ // 使用签字弹层的实际可视尺寸,避免 iOS WebView 中 100vh/innerHeight 包含不可见浏览器区域。
+ const containerWidth = this.$el.clientWidth || window.innerWidth
+ const containerHeight = this.$el.clientHeight || window.innerHeight
+ const canvas = this.$refs.signatureCanvas
signature = new SmoothSignature(canvas, {
- width: innerWidth - 30,
- height: innerHeight - 30,
+ width: Math.max(containerWidth - 30, 1),
+ height: Math.max(containerHeight - 30, 1),
scale: 2,
minWidth: 4,
maxWidth: 10,
@@ -101,11 +99,14 @@ module.exports = {