Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica.cloud.web-education-admin
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
提交
打开侧边栏
com.pica.cloud.education.frontend
pica.cloud.web-education-admin
提交
36ebad8d
提交
36ebad8d
编写于
7月 28, 2020
作者:
bo.dang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev-circle-live-20200715' into 'release'
裁剪优化,code review:bo.dang See merge request !200
上级
158dfdc1
4e0d69f1
变更
1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
17 行增加
和
9 行删除
+17
-9
cropper.vue
src/components/common/cropper.vue
+17
-9
未找到文件。
src/components/common/cropper.vue
浏览文件 @
36ebad8d
...
@@ -12,7 +12,9 @@
...
@@ -12,7 +12,9 @@
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
Cropper
from
'cropperjs'
let
vm
=
null
;
// import Cropper from 'cropperjs'
import
Cropper
from
"../../utils/cropperjs/cropper"
;
import
'cropperjs/dist/cropper.min.css'
import
'cropperjs/dist/cropper.min.css'
export
default
{
export
default
{
name
:
'rc-cropper2'
,
name
:
'rc-cropper2'
,
...
@@ -26,6 +28,9 @@
...
@@ -26,6 +28,9 @@
required
:
true
required
:
true
},
},
},
},
created
()
{
vm
=
this
;
},
data
()
{
data
()
{
return
{
return
{
cropper
:
null
,
cropper
:
null
,
...
@@ -53,7 +58,7 @@
...
@@ -53,7 +58,7 @@
// int_x = 800/_this.cropOption.cvWidth;
// int_x = 800/_this.cropOption.cvWidth;
// }
// }
//
//
// let int_y = _this.cropOption.cvHeight/
80
0;
// let int_y = _this.cropOption.cvHeight/
54
0;
// if(int_y >= 1){
// if(int_y >= 1){
// int_y = 540/_this.cropOption.cvHeight;
// int_y = 540/_this.cropOption.cvHeight;
// }
// }
...
@@ -124,9 +129,9 @@
...
@@ -124,9 +129,9 @@
highlight
:
true
,
highlight
:
true
,
cropBoxMovable
:
true
,
cropBoxMovable
:
true
,
zoomable
:
true
,
zoomable
:
true
,
cropBoxResizable
:
this
.
cropOption
.
cropBoxResizable
,
//是否显示等比例缩放
cropBoxResizable
:
vm
.
cropOption
.
cropBoxResizable
,
//是否显示等比例缩放
minCropBoxWidth
:
this
.
cropOption
.
minCropBoxWidth
,
// 剪切区域的最小宽度
minCropBoxWidth
:
vm
.
cropOption
.
minCropBoxWidth
,
// 剪切区域的最小宽度
minCropBoxHeight
:
this
.
cropOption
.
minCropBoxHeight
,
// 剪切区域的最小高度
minCropBoxHeight
:
vm
.
cropOption
.
minCropBoxHeight
,
// 剪切区域的最小高度
// minContainerHeight: 500,
// minContainerHeight: 500,
// minCanvasHeight: 500,
// minCanvasHeight: 500,
restore
:
true
,
restore
:
true
,
...
@@ -135,10 +140,10 @@
...
@@ -135,10 +140,10 @@
aspectRatio
:
this
.
cropOption
.
aspectRatio
,
// 显示等比例缩放的比例
aspectRatio
:
this
.
cropOption
.
aspectRatio
,
// 显示等比例缩放的比例
ready
:
()
=>
{
ready
:
()
=>
{
this
.
cropper
.
setData
({
this
.
cropper
.
setData
({
x
:
this
.
cropOption
.
offset_x
,
x
:
vm
.
cropOption
.
offset_x
,
y
:
this
.
cropOption
.
offset_y
,
y
:
vm
.
cropOption
.
offset_y
,
width
:
this
.
cropOption
.
width
,
width
:
vm
.
cropOption
.
width
,
height
:
this
.
cropOption
.
height
height
:
vm
.
cropOption
.
height
})
})
// this.cropper.setCropBoxData({
// this.cropper.setCropBoxData({
// width: 750,
// width: 750,
...
@@ -149,6 +154,7 @@
...
@@ -149,6 +154,7 @@
const
imageData
=
this
.
cropper
.
getImageData
();
const
imageData
=
this
.
cropper
.
getImageData
();
const
canvasData
=
this
.
cropper
.
getCanvasData
();
const
canvasData
=
this
.
cropper
.
getCanvasData
();
const
cropBoxData
=
this
.
cropper
.
getCropBoxData
();
console
.
log
(
"imageData width:"
+
imageData
.
width
);
console
.
log
(
"imageData width:"
+
imageData
.
width
);
console
.
log
(
"imageData height:"
+
imageData
.
height
);
console
.
log
(
"imageData height:"
+
imageData
.
height
);
console
.
log
(
"imageData naturalWidth:"
+
imageData
.
naturalWidth
);
console
.
log
(
"imageData naturalWidth:"
+
imageData
.
naturalWidth
);
...
@@ -157,6 +163,8 @@
...
@@ -157,6 +163,8 @@
console
.
log
(
"canvasData naturalHeight:"
+
canvasData
.
naturalHeight
);
console
.
log
(
"canvasData naturalHeight:"
+
canvasData
.
naturalHeight
);
console
.
log
(
"canvasData width:"
+
canvasData
.
width
);
console
.
log
(
"canvasData width:"
+
canvasData
.
width
);
console
.
log
(
"canvasData height:"
+
canvasData
.
height
);
console
.
log
(
"canvasData height:"
+
canvasData
.
height
);
console
.
log
(
"cropBoxData width:"
+
cropBoxData
.
width
);
console
.
log
(
"cropBoxData height:"
+
cropBoxData
.
height
);
// this.cropper.zoomTo(-0.2);
// this.cropper.zoomTo(-0.2);
const
containerData
=
this
.
cropper
.
getContainerData
();
const
containerData
=
this
.
cropper
.
getContainerData
();
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录