2019-02-07 08:05:59 +00:00
|
|
|
<template>
|
|
|
|
<div class="image-cropper">
|
2019-02-09 02:59:33 +00:00
|
|
|
<div v-if="dataUrl">
|
|
|
|
<div class="image-cropper-image-container">
|
|
|
|
<img ref="img" :src="dataUrl" alt="" @load.stop="createCropper" />
|
2019-02-07 08:05:59 +00:00
|
|
|
</div>
|
2019-02-09 02:59:33 +00:00
|
|
|
<div class="image-cropper-buttons-wrapper">
|
|
|
|
<button class="btn" type="button" :disabled="submitting" @click="submit" v-text="saveText"></button>
|
|
|
|
<button class="btn" type="button" :disabled="submitting" @click="destroy" v-text="cancelText"></button>
|
|
|
|
<i class="icon-spin4 animate-spin" v-if="submitting"></i>
|
2019-02-07 08:05:59 +00:00
|
|
|
</div>
|
2019-02-09 02:59:33 +00:00
|
|
|
<div class="alert error" v-if="submitError">
|
2019-02-09 03:17:53 +00:00
|
|
|
{{submitErrorMsg}}
|
2019-02-09 02:59:33 +00:00
|
|
|
<i class="button-icon icon-cancel" @click="clearError"></i>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-02-07 08:05:59 +00:00
|
|
|
<input ref="input" type="file" class="image-cropper-img-input" :accept="mimes">
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script src="./image_cropper.js"></script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.image-cropper {
|
|
|
|
&-img-input {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
&-image-container {
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
img {
|
|
|
|
display: block;
|
|
|
|
max-width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-09 02:59:33 +00:00
|
|
|
&-buttons-wrapper {
|
|
|
|
margin-top: 15px;
|
2019-02-07 08:05:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|