sunnyqjm / taro-cropper Goto Github PK
View Code? Open in Web Editor NEWTaro框架下的跨端图片裁剪组件,目前支持微信小程序端,QQ小程序端, 支付宝小程序端, 字节跳动小程序端, 百度小程序端和H5端
Home Page: https://sunnyqjm.github.io/taro-cropper/#/
Taro框架下的跨端图片裁剪组件,目前支持微信小程序端,QQ小程序端, 支付宝小程序端, 字节跳动小程序端, 百度小程序端和H5端
Home Page: https://sunnyqjm.github.io/taro-cropper/#/
全屏模式下Android高度出现问题,导致取消和确定按钮的定位存在问题,会看不见取消和确定
我用Taro.chooseImage({
sizeType: ['original']}),使用original模式,然后把图片链接传给TaroCropper。
这时候在拖拽图片的时候会卡顿。如果使用compressed模式就正常。
应该是图片大小导致拖拽卡顿的。
描述:顶部和底部的显示是固定的,中间空白的地方放入这个taro-cropper组件,通过select('#id).boundingClientRect(),获取要填充部分的宽高,将此宽高可是传入taro-cropper之后,taro-cropper占据的位置比预测的小很多,请问这个自适应怎么处理,谢谢!
测试机型:iphone7 plus
运行系统:IOS 10.3.2
微信版本:7.0.5
基础库版本:2.8.1[282]
小程序默认导出为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,
})
hideFinishText传入boolean值为true,自带的完成按钮依然存在
支付宝版本: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: '点击取消'
})
}}
/>
百度小程序 被裁剪的图片会被放大 无法裁剪
通过npm引入,import TaroCropper from 'taro-cropper',微信小程序编译后,/base.wxml中出现大量未使用到的组件,如<live-puhser>等音视频录制的组件
开发环境:taro3.6.5, 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)
安装报错了~
Maximum call stack size exceeded
比如 cropperWidth 设置500 展示的图片比绿框里的小 cropperWidth 设置400 图片会有白边
请问不通过自带的完成按钮,怎么调取onCut
裁剪的图片是放在了本地吗,怎样能拿到裁剪图片的文件流?
hideFinishText无效
《小程序 wx.getSystemInfoSync 获取 windowHeight 不准确的问题》:https://blog.csdn.net/weixin_42661321/article/details/82180496
这篇文章上说,getSystemInfoSync是不准确的。
在我的实测中发现,当小程序存在tabBar时,隐藏小程序再让小程序出现,出发pageShow后的小程序高度就错误了。
建议,使用css自动计算出页面高度
裁剪图片后,图片像素变低了,模糊
🙅 编译失败. 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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.