Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. <template>
  2. <div
  3. :ref="cellId"
  4. >
  5. </div>
  6. </template>
  7.  
  8. <script>
  9. export default {
  10. data: function() {
  11. return {
  12. cellId: '_' + Math.random().toString(36).substr(2, 9)
  13. };
  14. },
  15. methods: {
  16. updateCellHeight: function() {
  17. this.$refs[this.cellId].clientHeight = this.$refs[this.cellId].clientWidth;
  18. }
  19. },
  20. created: function() {
  21. window.addEventListener("resize", this.updateCellHeight);
  22. this.updateCellHeight();
  23. },
  24. destroyed: function() {
  25. window.removeEventListener("resize", this.updateCellHeight);
  26. }
  27. }
  28. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement