<image-cropper
:isVisible.sync="isVisible"
model=“base64”
@transmitImageData="transmitImageData"
>
</image-cropper>
<template>
<div id="app">
<div class="my-title">
vue-image-cropper-simple
</div>
<div class="gogo">
<img alt="Vue logo" :src="imageSrc" @click="go" />
<p>点击图片上传</p>
</div>
<image-cropper
:isVisible.sync="isVisible"
model="base64"
@transmitImageData="transmitImageData"
></image-cropper>
</div>
</template>
<script>
import ImageCropper from "vue-image-cropper-simple";
export default {
name: "App",
data() {
return {
isVisible: false,
imageSrc: "/logo.png"
};
},
methods: {
go() {
this.isVisible = !this.isVisible;
},
transmitImageData(imageDataBase64) {
this.imageSrc = imageDataBase64;
}
},
components: { ImageCropper }
};
</script>