08-responsive-predefined-layouts.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. var testLayouts = {
  2. md: [
  3. {"x":0, "y":0, "w":2, "h":2, "i":"0"},
  4. {"x":2, "y":0, "w":2, "h":4, "i":"1"},
  5. {"x":4, "y":0, "w":2, "h":5, "i":"2"},
  6. {"x":6, "y":0, "w":2, "h":3, "i":"3"},
  7. {"x":2, "y":4, "w":2, "h":3, "i":"4"},
  8. {"x":4, "y":5, "w":2, "h":3, "i":"5"},
  9. {"x":0, "y":2, "w":2, "h":5, "i":"6"},
  10. {"x":2, "y":7, "w":2, "h":5, "i":"7"},
  11. {"x":4, "y":8, "w":2, "h":5, "i":"8"},
  12. {"x":6, "y":3, "w":2, "h":4, "i":"9"},
  13. {"x":0, "y":7, "w":2, "h":4, "i":"10"},
  14. {"x":2, "y":19, "w":2, "h":4, "i":"11"},
  15. {"x":0, "y":14, "w":2, "h":5, "i":"12"},
  16. {"x":2, "y":14, "w":2, "h":5, "i":"13"},
  17. {"x":4, "y":13, "w":2, "h":4, "i":"14"},
  18. {"x":6, "y":7, "w":2, "h":4, "i":"15"},
  19. {"x":0, "y":19, "w":2, "h":5, "i":"16"},
  20. {"x":8, "y":0, "w":2, "h":2, "i":"17"},
  21. {"x":0, "y":11, "w":2, "h":3, "i":"18"},
  22. {"x":2, "y":12, "w":2, "h":2, "i":"19"}
  23. ],
  24. lg: [
  25. {"x":0,"y":0,"w":2,"h":2,"i":"0"},
  26. {"x":2,"y":0,"w":2,"h":4,"i":"1"},
  27. {"x":4,"y":0,"w":2,"h":5,"i":"2"},
  28. {"x":6,"y":0,"w":2,"h":3,"i":"3"},
  29. {"x":8,"y":0,"w":2,"h":3,"i":"4"},
  30. {"x":10,"y":0,"w":2,"h":3,"i":"5"},
  31. {"x":0,"y":5,"w":2,"h":5,"i":"6"},
  32. {"x":2,"y":5,"w":2,"h":5,"i":"7"},
  33. {"x":4,"y":5,"w":2,"h":5,"i":"8"},
  34. {"x":6,"y":4,"w":2,"h":4,"i":"9"},
  35. {"x":8,"y":4,"w":2,"h":4,"i":"10"},
  36. {"x":10,"y":4,"w":2,"h":4,"i":"11"},
  37. {"x":0,"y":10,"w":2,"h":5,"i":"12"},
  38. {"x":2,"y":10,"w":2,"h":5,"i":"13"},
  39. {"x":4,"y":8,"w":2,"h":4,"i":"14"},
  40. {"x":6,"y":8,"w":2,"h":4,"i":"15"},
  41. {"x":8,"y":10,"w":2,"h":5,"i":"16"},
  42. {"x":10,"y":4,"w":2,"h":2,"i":"17"},
  43. {"x":0,"y":9,"w":2,"h":3,"i":"18"},
  44. {"x":2,"y":6,"w":2,"h":2,"i":"19"}
  45. ],
  46. };
  47. var app = Vue.createApp({
  48. data() {
  49. return {
  50. layouts: testLayouts,
  51. layout: testLayouts["lg"],
  52. draggable: true,
  53. resizable: true,
  54. responsive: true,
  55. index: 0
  56. }
  57. },
  58. mounted: function () {
  59. // this.index = this.layout.length;
  60. },
  61. methods: {
  62. breakpointChangedEvent: function(newBreakpoint, newLayout){
  63. console.log("BREAKPOINT CHANGED breakpoint=", newBreakpoint, ", layout: ", newLayout );
  64. }
  65. }
  66. }).use(VueGridLayout);
  67. // app.component("grid-item", VueGridLayout.GridItem);
  68. // app.component("grid-layout", VueGridLayout.GridLayout);
  69. app.mount("#app");