本文实例为大家分享了vue移动端图片裁剪上传的具体代码,供大家参考,具体内容如下
1. 安装cropperjs依赖库
2. 编写组件SimpleCropper.vue
<style lang="less">
.v-simple-cropper {
.file {
display: none;
}
.v-cropper-layer {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: #fff;
z-index: 99999;
display: none;
.layer-header {
position: absolute;
top: 0;
left: 0;
z-index: 99999;
background: #fff;
width: 100%;
height: .8rem;
padding: 0 .2rem;
Box-sizing: border-Box;
}
.cancel,.confirm {
line-height: .8rem;
font-size: .28rem;
background: inherit;
border: 0;
outline: 0;
float: left;
}
.confirm {
float: right;
}
img {
position: inherit!important;
border-radius: inherit!important;
float: inherit!important;
}
}
}