签名倒置问题优化
This commit is contained in:
parent
0eba5a56fe
commit
f66c81d03b
|
|
@ -22,7 +22,7 @@
|
||||||
<view class="fun-box-btn clear flex" @click="clear">
|
<view class="fun-box-btn clear flex" @click="clear">
|
||||||
<text>清空</text>
|
<text>清空</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="fun-box-btn confirm flex" @click="confirm">
|
<view v-if="isLandscape" class="fun-box-btn confirm flex" @click="confirm">
|
||||||
<text>确认</text>
|
<text>确认</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="fun-box-btn cancel flex" @click="cancel">
|
<view class="fun-box-btn cancel flex" @click="cancel">
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, watch, getCurrentInstance } from 'vue'
|
import { ref, reactive, watch, getCurrentInstance, onMounted, onUnmounted } from 'vue'
|
||||||
import { useMemberStore } from '@/stores'
|
import { useMemberStore } from '@/stores'
|
||||||
|
|
||||||
const emits = defineEmits(['update:modelValue', 'complete'])
|
const emits = defineEmits(['update:modelValue', 'complete'])
|
||||||
|
|
@ -71,6 +71,36 @@ if (memberStore.userInfo.nickName && memberStore.userInfo.nickName.length < 5) {
|
||||||
|
|
||||||
const paths = ref([]) // 保存所有笔迹(每笔是一组点数组)
|
const paths = ref([]) // 保存所有笔迹(每笔是一组点数组)
|
||||||
const PEN = { width: 6, color: '#000000' } // 若你已有类似配置可复用
|
const PEN = { width: 6, color: '#000000' } // 若你已有类似配置可复用
|
||||||
|
const isLandscape = ref(true) // 屏幕是否为横向
|
||||||
|
|
||||||
|
// 监听屏幕旋转
|
||||||
|
const handleResize = () => {
|
||||||
|
const { windowWidth, windowHeight } = uni.getSystemInfoSync()
|
||||||
|
console.log('🚀 ~ handleResize ~ windowWidth, windowHeight:', windowWidth, windowHeight)
|
||||||
|
isLandscape.value = windowWidth < windowHeight
|
||||||
|
|
||||||
|
// 重新绘制 canvas 背景
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.createSelectorQuery()
|
||||||
|
.in(_this)
|
||||||
|
.select('#mycanvas')
|
||||||
|
.fields({ size: true, rect: true }, (data) => {
|
||||||
|
if (data) {
|
||||||
|
drawBackground(canvaCtx, data.width, data.height)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.exec()
|
||||||
|
}, 50)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
uni.onWindowResize(handleResize)
|
||||||
|
handleResize() // 初始执行一次
|
||||||
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
uni.offWindowResize(handleResize)
|
||||||
|
})
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.modelValue,
|
() => props.modelValue,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue