Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <template>
  2. <vue-cropper-js
  3. ref="cropper"
  4. :guides="true"
  5. :view-mode="2"
  6. drag-mode="crop"
  7. :auto-crop-area="0.5"
  8. :min-container-width="250"
  9. :min-container-height="180"
  10. :background="false"
  11. :rotatable="true"
  12. :src="imgSrc"
  13. alt="Source Image"
  14. :img-style="{ 'width': '400px', 'height': '300px' }"
  15. ></vue-cropper-js>
  16. </template>
  17.  
  18. <script>
  19. import VueCropperJs from 'vue-cropperjs';
  20. import 'cropperjs/dist/cropper.css';
  21.  
  22. export default {
  23. components: { VueCropperJs },
  24. props: {
  25. imgSrc: String,
  26. },
  27. watch: {
  28. imgSrc() {
  29. this.$refs.cropper.replace(this.imgSrc);
  30. },
  31. },
  32. methods: {
  33. getDataURL() {
  34. return this.$refs.cropper.getCroppedCanvas().toDataURL();
  35. },
  36. clear() {
  37. this.$refs.cropper.clear();
  38. }
  39. },
  40. }
  41. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement