Giter Site home page Giter Site logo

sunnyqjm / taro-cropper Goto Github PK

View Code? Open in Web Editor NEW
105.0 3.0 44.0 277 KB

Taro框架下的跨端图片裁剪组件,目前支持微信小程序端,QQ小程序端, 支付宝小程序端, 字节跳动小程序端, 百度小程序端和H5端

Home Page: https://sunnyqjm.github.io/taro-cropper/#/

JavaScript 8.30% TypeScript 87.11% HTML 3.30% SCSS 1.30%

taro-cropper's Issues

图片大拖拽会卡顿

我用Taro.chooseImage({
sizeType: ['original']}),使用original模式,然后把图片链接传给TaroCropper。
这时候在拖拽图片的时候会卡顿。如果使用compressed模式就正常。
应该是图片大小导致拖拽卡顿的。

传入高度和宽度自适应问题

描述:顶部和底部的显示是固定的,中间空白的地方放入这个taro-cropper组件,通过select('#id).boundingClientRect(),获取要填充部分的宽高,将此宽高可是传入taro-cropper之后,taro-cropper占据的位置比预测的小很多,请问这个自适应怎么处理,谢谢!

安卓手机上图片导出体积较大,原因为未设置图片格式和质量

小程序默认导出为png,但是jpg其实比png小很多。再说图片质量,0.8和1,也能差1倍大小。

截图:https://n1image.hjfile.cn/res7/2020/02/15/e09eb0e716500c9039052f2361deabef.png

我自己改为如下代码

Taro.canvasToTempFilePath({
        canvasId: cropperCutCanvasId,
        x: 0,
        y: 0,
        width: this.cropperWidth - 2,
        height: this.cropperHeight - 2,
        destWidth: this.cropperWidth * this.systemInfo.pixelRatio,
        destHeight: this.cropperHeight * this.systemInfo.pixelRatio,
        fileType: 'jpg',
        quality: isAndroid() ? 0.8 : 1,
})

支付宝小程序中挪动图片,图片会闪烁,放大缩小同样会。

支付宝版本:10.1.95
测试机:iphone Xs Max
代码:

<TaroCropper
height={600}
fullScreen
src={src}
cropperWidth={400}
cropperHeight={400}
ref={this.catTaroCropper}
onCut={this.handleCutImg}
hideCancelText={false}
quality={1}
onCancel={() => {
Taro.showToast({
icon: 'none',
title: '点击取消'
})
}}
/>

小程序Audits 发现6个废弃api

使用即将废弃或已废弃接口,可能导致小程序运行不正常。一般而言,接口不会立即去掉,但保险起见,建议不要使用,避免后续小程序突然运行异常。

taro-cropper:version 1.0.9
微信开发者工具版本:1.02.1911180
调试基础库: 2.9.4

image

3.0编译报错 (已经使用了taro-cropper@react)

taro版本 3.0.14
基础库 2.14.0
使用 taro-cropper@react 版本之后仍然编译报错, 这是我本地少了什么东西吗
./node_modules/_taro-cropper@1.2.4@taro-cropper/dist/weapp/components/taro-cropper/index.tsx
Module build failed (from ./node_modules/_babel-loader@8.0.6@babel-loader/lib/index.js):
SyntaxError: /Users/zhuowenhao/Desktop/zjcj/weapp/node_modules/_taro-cropper@1.2.4@taro-cropper/dist/weapp/components/taro-cropper/index.tsx: Unexpected reserved word 'interface' (10:0)
image

taro3.1.0更新到3.2.0报错

🙅 编译失败. 2022/8/22 下午1:47:51

./node_modules/taro-cropper/dist/weapp/components/taro-cropper/index.tsx
Module build failed (from ./node_modules/@tarojs/mini-runner/node_modules/babel-loader/lib/index.js):
SyntaxError: E:\project\deepexi-dm-mobile1\node_modules\taro-cropper\dist\weapp\components\taro-cropper\index.tsx: Unexpected reserved word 'interface'. (10:0)

8 |
9 |

10 | interface TaroCropperComponentProps {
| ^
11 | cropperCanvasId: string, // 画布id
12 | cropperCutCanvasId: string, // 用于裁剪的canvas id
13 | width: number, // 组件宽度

监听文件修改中...
9 |

10 | interface TaroCropperComponentProps {
| ^
11 | cropperCanvasId: string, // 画布id 12 | cropperCutCanvasId: string, // 用于裁剪的canvas id
13 | width: number, // 组件宽度

(node:27628) UnhandledPromiseRejectionWarning: [object Array]
(Use node --trace-warnings ... to show where the warning was created)
(node:27628) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)
(node:27628) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.