image_cropper.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <div class="image-cropper">
  3. <div v-if="dataUrl">
  4. <div class="image-cropper-image-container">
  5. <img
  6. ref="img"
  7. :src="dataUrl"
  8. alt=""
  9. @load.stop="createCropper"
  10. >
  11. </div>
  12. <div class="image-cropper-buttons-wrapper">
  13. <button
  14. class="button-default btn"
  15. type="button"
  16. :disabled="submitting"
  17. @click="submit()"
  18. v-text="saveText"
  19. />
  20. <button
  21. class="button-default btn"
  22. type="button"
  23. :disabled="submitting"
  24. @click="destroy"
  25. v-text="cancelText"
  26. />
  27. <button
  28. class="button-default btn"
  29. type="button"
  30. :disabled="submitting"
  31. @click="submit(false)"
  32. v-text="saveWithoutCroppingText"
  33. />
  34. <FAIcon
  35. v-if="submitting"
  36. spin
  37. icon="circle-notch"
  38. />
  39. </div>
  40. </div>
  41. <input
  42. ref="input"
  43. type="file"
  44. class="image-cropper-img-input"
  45. :accept="mimes"
  46. >
  47. </div>
  48. </template>
  49. <script src="./image_cropper.js"></script>
  50. <style lang="scss">
  51. .image-cropper {
  52. &-img-input {
  53. display: none;
  54. }
  55. &-image-container {
  56. position: relative;
  57. img {
  58. display: block;
  59. max-width: 100%;
  60. }
  61. }
  62. &-buttons-wrapper {
  63. margin-top: 10px;
  64. button {
  65. margin-top: 5px;
  66. }
  67. }
  68. }
  69. </style>