Guest User

Untitled

a guest
Jan 17th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. <template>
  2. <div>
  3. <!-- SOURCE -->
  4. <div ref="printMe">
  5. <h1>Print me!</h1>
  6. </div>
  7. <!-- OUTPUT -->
  8. <img :src="output">
  9. </div>
  10. <template>
  11.  
  12.  
  13. <script>
  14. export default {
  15. data() {
  16. return {
  17. output: null
  18. }
  19. },
  20. methods: {
  21. print() {
  22. const el = this.$refs.printMe;
  23. // add option type to get the image version
  24. // if not provided the promise will return
  25. // the canvas.
  26. const options = {
  27. type: 'dataURL'
  28. }
  29. this.output = await this.$html2canvas(el, options);
  30. }
  31. }
  32. }
  33. </script>
Add Comment
Please, Sign In to add comment