Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
5e36a8b5
Unverified
提交
5e36a8b5
authored
4月 17, 2021
作者:
啝裳
提交者:
GitHub
4月 17, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
perf: improve cropper example (#491)
上级
e1b30a50
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
25 行增加
和
18 行删除
+25
-18
index.vue
src/views/demo/comp/cropper/index.vue
+25
-18
没有找到文件。
src/views/demo/comp/cropper/index.vue
浏览文件 @
5e36a8b5
<
template
>
<
template
>
<PageWrapper
title=
"图片裁剪示例"
contentBackground
>
<PageWrapper
title=
"图片裁剪示例"
contentBackground
>
<div
class=
"cropper-container"
>
<div
class=
"container"
>
<CropperImage
<div
class=
"cropper-container"
>
ref=
"refCropper"
<CropperImage
src=
"https://fengyuanchen.github.io/cropperjs/images/picture.jpg"
ref=
"refCropper"
@
cropperedInfo=
"cropperedInfo"
src=
"https://fengyuanchen.github.io/cropperjs/images/picture.jpg"
style=
"width: 40%"
@
cropperedInfo=
"cropperedInfo"
/>
style=
"width: 40vw"
/>
</div>
<a-button
type=
"primary"
@
click=
"onCropper"
>
裁剪
</a-button>
<a-button
type=
"primary"
@
click=
"onCropper"
>
裁剪
</a-button>
<img
:src=
"cropperImg"
class=
"croppered"
v-if=
"cropperImg"
/>
<img
:src=
"cropperImg"
class=
"croppered"
v-if=
"cropperImg"
/>
</div>
</div>
...
@@ -14,28 +16,26 @@
...
@@ -14,28 +16,26 @@
</PageWrapper>
</PageWrapper>
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
defineComponent
,
ref
,
onBeforeMount
,
getCurrentInstance
}
from
'vue'
;
import
{
defineComponent
,
ref
,
unref
}
from
'vue'
;
import
{
PageWrapper
}
from
'/@/components/Page'
;
import
{
PageWrapper
}
from
'/@/components/Page'
;
import
{
CropperImage
}
from
'/@/components/Cropper'
;
import
{
CropperImage
}
from
'/@/components/Cropper'
;
import
img
from
'/@/assets/images/header.jpg'
;
import
img
from
'/@/assets/images/header.jpg'
;
import
{
templateRef
}
from
'@vueuse/core'
;
export
default
defineComponent
({
export
default
defineComponent
({
components
:
{
components
:
{
PageWrapper
,
PageWrapper
,
CropperImage
,
CropperImage
,
},
},
setup
()
{
setup
()
{
let
vm
:
any
;
let
info
=
ref
(
''
);
let
info
=
ref
(
''
);
let
cropperImg
=
ref
(
''
);
let
cropperImg
=
ref
(
''
);
const
refCropper
=
templateRef
<
HTMLElement
|
null
>
(
'refCropper'
,
null
);
const
onCropper
=
():
void
=>
{
const
onCropper
=
():
void
=>
{
vm
.
refs
.
refCropper
.
croppered
();
unref
(
refCropper
)
.
croppered
();
};
};
onBeforeMount
(()
=>
{
vm
=
getCurrentInstance
();
});
function
cropperedInfo
({
imgBase64
,
imgInfo
})
{
function
cropperedInfo
({
imgBase64
,
imgInfo
})
{
info
.
value
=
imgInfo
;
info
.
value
=
imgInfo
;
cropperImg
.
value
=
imgBase64
;
cropperImg
.
value
=
imgBase64
;
...
@@ -53,14 +53,21 @@
...
@@ -53,14 +53,21 @@
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
.c
ropper-c
ontainer
{
.container
{
display
:
flex
;
display
:
flex
;
justify-content
:
space-around
;
width
:
100vw
;
align-items
:
center
;
align-items
:
center
;
}
}
.cropper-container
{
width
:
40vw
;
}
.croppered
{
.croppered
{
width
:
50%
;
height
:
360px
;
height
:
100%
;
}
p
{
margin
:
10px
;
}
}
</
style
>
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论