05-mirrored.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Vue Grid Layout Example 4 - Mirrored grid layout</title>
  6. <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
  7. <!--<link rel="stylesheet" href="../dist/vue-grid-layout.css">-->
  8. <link rel="stylesheet" href="app.css">
  9. </head>
  10. <body>
  11. <h1>Vue Grid Layout Example 5 - Mirrored grid layout</h1>
  12. <a href="https://github.com/jbaysolutions/vue-grid-layout">View project on Github</a>
  13. <br/>
  14. <a href="04-allow-ignore.html">Previous example: Drag allow/ignore elements</a>
  15. <br/>
  16. <a href="06-responsive.html">Next example: Responsive</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>
  29. <div id="content">
  30. <!--<button @click="decreaseWidth">Decrease Width</button>
  31. <button @click="increaseWidth">Increase Width</button>
  32. <button @click="addItem">Add an item</button>-->
  33. <input type="checkbox" v-model="draggable"/> Draggable
  34. <input type="checkbox" v-model="resizable"/> Resizable
  35. <input type="checkbox" v-model="mirrored"/> Mirrored
  36. <br/>
  37. <grid-layout :layout="layout"
  38. :col-num="12"
  39. :row-height="30"
  40. :is-draggable="draggable"
  41. :is-resizable="resizable"
  42. :is-mirrored="mirrored"
  43. :vertical-compact="true"
  44. :use-css-transforms="true"
  45. >
  46. <grid-item v-for="item in layout"
  47. :x="item.x"
  48. :y="item.y"
  49. :w="item.w"
  50. :h="item.h"
  51. :i="item.i"
  52. >
  53. <span class="text">{{item.i}}</span>
  54. </grid-item>
  55. </grid-layout>
  56. </div>
  57. </div>
  58. <script src="vue.min.js"></script>
  59. <script src="../dist/vue-grid-layout.umd.min.js"></script>
  60. <script type="text/javascript">
  61. const testLayout = [
  62. {"x":0,"y":0,"w":2,"h":2,"i":"0"},
  63. {"x":2,"y":0,"w":2,"h":4,"i":"1"},
  64. {"x":4,"y":0,"w":2,"h":5,"i":"2"},
  65. {"x":6,"y":0,"w":2,"h":3,"i":"3"},
  66. {"x":8,"y":0,"w":2,"h":3,"i":"4"},
  67. {"x":10,"y":0,"w":2,"h":3,"i":"5"},
  68. {"x":0,"y":5,"w":2,"h":5,"i":"6"},
  69. {"x":2,"y":5,"w":2,"h":5,"i":"7"},
  70. {"x":4,"y":5,"w":2,"h":5,"i":"8"},
  71. {"x":6,"y":4,"w":2,"h":4,"i":"9"},
  72. {"x":8,"y":4,"w":2,"h":4,"i":"10"},
  73. {"x":10,"y":4,"w":2,"h":4,"i":"11"},
  74. {"x":0,"y":10,"w":2,"h":5,"i":"12"},
  75. {"x":2,"y":10,"w":2,"h":5,"i":"13"},
  76. {"x":4,"y":8,"w":2,"h":4,"i":"14"},
  77. {"x":6,"y":8,"w":2,"h":4,"i":"15"},
  78. {"x":8,"y":10,"w":2,"h":5,"i":"16"},
  79. {"x":10,"y":4,"w":2,"h":2,"i":"17"},
  80. {"x":0,"y":9,"w":2,"h":3,"i":"18"},
  81. {"x":2,"y":6,"w":2,"h":2,"i":"19"}
  82. ];
  83. new Vue({
  84. el: '#app',
  85. data: {
  86. layout: testLayout,
  87. draggable: true,
  88. resizable: true,
  89. mirrored: true,
  90. index: 0
  91. },
  92. });
  93. </script>
  94. </body>
  95. </html>