适配鸿蒙
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<cl-page>
|
<cl-page>
|
||||||
<cl-sign ref="signRef" :height="height" :enable-brush="isBrush"></cl-sign>
|
<cl-sign ref="signRef" :height="height" :width="width" :enable-brush="isBrush"></cl-sign>
|
||||||
|
|
||||||
<view class="p-3">
|
<view class="p-3">
|
||||||
<cl-list>
|
<cl-list>
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
</cl-list-item>
|
</cl-list-item>
|
||||||
|
|
||||||
<cl-list-item label="大屏">
|
<cl-list-item label="大屏">
|
||||||
<cl-switch v-model="isFullscreen"></cl-switch>
|
<cl-switch v-model="isFullscreen" @change="onFullscreenChange"></cl-switch>
|
||||||
</cl-list-item>
|
</cl-list-item>
|
||||||
|
|
||||||
<cl-list-item label="毛笔效果">
|
<cl-list-item label="毛笔效果">
|
||||||
@@ -22,11 +22,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
|
||||||
const height = computed(() => {
|
const height = ref(0);
|
||||||
return isFullscreen.value ? uni.getWindowInfo().windowHeight - 200 : 200;
|
const width = ref(0);
|
||||||
});
|
|
||||||
|
|
||||||
const isFullscreen = ref(false);
|
const isFullscreen = ref(false);
|
||||||
const isBrush = ref(true);
|
const isBrush = ref(true);
|
||||||
@@ -43,4 +42,15 @@ function preview() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onFullscreenChange() {
|
||||||
|
height.value = isFullscreen.value ? uni.getWindowInfo().windowHeight - 200 : 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
onReady(() => {
|
||||||
|
const { windowWidth } = uni.getWindowInfo();
|
||||||
|
|
||||||
|
height.value = 200;
|
||||||
|
width.value = windowWidth;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -521,8 +521,6 @@ function initCrop() {
|
|||||||
container.height = windowHeight;
|
container.height = windowHeight;
|
||||||
container.width = windowWidth;
|
container.width = windowWidth;
|
||||||
|
|
||||||
console.log(container);
|
|
||||||
|
|
||||||
// 设置裁剪框尺寸为传入的初始值
|
// 设置裁剪框尺寸为传入的初始值
|
||||||
cropBox.width = props.cropWidth; // 设置裁剪框宽度
|
cropBox.width = props.cropWidth; // 设置裁剪框宽度
|
||||||
cropBox.height = props.cropHeight; // 设置裁剪框高度
|
cropBox.height = props.cropHeight; // 设置裁剪框高度
|
||||||
@@ -633,7 +631,7 @@ function onImageLoaded(e: UniImageLoadEvent) {
|
|||||||
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
// 执行初始化流程
|
// 执行初始化流程
|
||||||
initCrop(); // 初始化裁剪框位置和尺寸
|
reset(); // 重置裁剪框
|
||||||
setInitialImageSize(); // 设置图片初始显示尺寸
|
setInitialImageSize(); // 设置图片初始显示尺寸
|
||||||
adjustBounds(); // 调整图片边界确保覆盖裁剪框
|
adjustBounds(); // 调整图片边界确保覆盖裁剪框
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -376,8 +376,6 @@ function onTouchStart(e: UniTouchEvent) {
|
|||||||
* 计算手指移动距离,更新弹出层位置
|
* 计算手指移动距离,更新弹出层位置
|
||||||
*/
|
*/
|
||||||
function onTouchMove(e: UniTouchEvent) {
|
function onTouchMove(e: UniTouchEvent) {
|
||||||
console.log(111);
|
|
||||||
|
|
||||||
if (swipe.isTouch) {
|
if (swipe.isTouch) {
|
||||||
// 标记为移动状态
|
// 标记为移动状态
|
||||||
swipe.isMove = true;
|
swipe.isMove = true;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ const props = defineProps({
|
|||||||
// 画布宽度
|
// 画布宽度
|
||||||
width: {
|
width: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: () => uni.getWindowInfo().windowWidth
|
default: 300
|
||||||
},
|
},
|
||||||
// 画布高度
|
// 画布高度
|
||||||
height: {
|
height: {
|
||||||
|
|||||||
Reference in New Issue
Block a user