02-events.html 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Vue Grid Layout Example 2 - Move and resize events</title>
  6. <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
  7. <link rel="stylesheet" href="app.css">
  8. <!--<link rel="stylesheet" href="../dist/vue-grid-layout.css">-->
  9. </head>
  10. <body>
  11. <h1>Vue Grid Layout Example 2 - Move and resize events</h1>
  12. <a href="https://github.com/jbaysolutions/vue-grid-layout">View project on Github</a>
  13. <br/>
  14. <a href="01-basic.html">Previous example: Basic</a>
  15. <br/>
  16. <a href="03-multiple-grids.html">Next example: Multiple grids</a>
  17. <div id="app" style="width: 100%;">
  18. <!--<pre>{{ $data | json }}</pre>-->
  19. <div>
  20. <div class="layoutJSON">
  21. Displayed as <code>[x, y, w, h]</code>:
  22. <div class="columns">
  23. <div class="layoutItem" v-for="item in layout">
  24. <b>{{item.i}}</b>: [{{item.x}}, {{item.y}}, {{item.w}}, {{item.h}}]
  25. </div>
  26. </div>
  27. </div>
  28. <div ref="eventsDiv" class="eventsJSON">
  29. Events:
  30. <div v-for="event in eventLog">
  31. {{event}}
  32. </div>
  33. </div>
  34. </div>
  35. <div id="content">
  36. <!--<button @click="decreaseWidth">Decrease Width</button>
  37. <button @click="increaseWidth">Increase Width</button>
  38. <button @click="addItem">Add an item</button>-->
  39. <grid-layout :layout="layout"
  40. :col-num="12"
  41. :row-height="30"
  42. :is-draggable="true"
  43. :is-resizable="true"
  44. :vertical-compact="true"
  45. :use-css-transforms="true"
  46. @layout-created="layoutCreatedEvent"
  47. @layout-before-mount="layoutBeforeMountEvent"
  48. @layout-mounted="layoutMountedEvent"
  49. @layout-ready="layoutReadyEvent"
  50. @layout-updated="layoutUpdatedEvent"
  51. >
  52. <grid-item v-for="item in layout"
  53. :x="item.x"
  54. :y="item.y"
  55. :w="item.w"
  56. :h="item.h"
  57. :i="item.i"
  58. @resize="resizeEvent"
  59. @move="moveEvent"
  60. @resized="resizedEvent"
  61. @container-resized="containerResizedEvent"
  62. @moved="movedEvent"
  63. >
  64. <span class="text">{{item.i}}</span>
  65. </grid-item>
  66. </grid-layout>
  67. </div>
  68. <!--<pre>{{eventLog | json}}</pre>-->
  69. </div>
  70. <script src="vue.min.js"></script>
  71. <script src="../dist/vue-grid-layout.umd.min.js"></script>
  72. <script src="02-events.js"></script>
  73. </body>
  74. </html>