07-prevent-collision.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. var testLayout = [
  2. {"x":0,"y":0,"w":2,"h":5,"i":"0", static: false},
  3. {"x":2,"y":0,"w":2,"h":2,"i":"1", static: false},
  4. {"x":4,"y":0,"w":2,"h":5,"i":"2", static: false},
  5. {"x":6,"y":0,"w":2,"h":3,"i":"3", static: false},
  6. {"x":8,"y":0,"w":2,"h":3,"i":"4", static: false},
  7. {"x":10,"y":0,"w":2,"h":3,"i":"5", static: false},
  8. {"x":0,"y":5,"w":2,"h":5,"i":"6", static: false},
  9. {"x":2,"y":5,"w":2,"h":5,"i":"7", static: false},
  10. {"x":4,"y":5,"w":2,"h":5,"i":"8", static: false},
  11. {"x":6,"y":3,"w":2,"h":4,"i":"9", static: false},
  12. {"x":8,"y":4,"w":2,"h":4,"i":"10", static: false},
  13. {"x":10,"y":4,"w":2,"h":4,"i":"11", static: false},
  14. {"x":0,"y":10,"w":2,"h":5,"i":"12", static: false},
  15. {"x":2,"y":10,"w":2,"h":5,"i":"13", static: false},
  16. {"x":4,"y":8,"w":2,"h":4,"i":"14", static: false},
  17. {"x":6,"y":8,"w":2,"h":4,"i":"15", static: false},
  18. {"x":8,"y":10,"w":2,"h":5,"i":"16", static: false},
  19. {"x":10,"y":4,"w":2,"h":2,"i":"17", static: false},
  20. {"x":0,"y":9,"w":2,"h":3,"i":"18", static: false},
  21. {"x":2,"y":6,"w":2,"h":2,"i":"19", static: false}
  22. ];
  23. // var GridLayout = VueGridLayout.GridLayout;
  24. // var GridItem = VueGridLayout.GridItem;
  25. new Vue({
  26. el: '#app',
  27. // components: {
  28. // "GridLayout": GridLayout,
  29. // "GridItem": GridItem
  30. // },
  31. data: {
  32. layout: testLayout,
  33. draggable: true,
  34. resizable: true,
  35. index: 0
  36. },
  37. /*
  38. mounted: function () {
  39. this.index = this.layout.length;
  40. },
  41. */
  42. methods: {
  43. itemTitle(item) {
  44. var result = item.i;
  45. if (item.static) {
  46. result += " - Static";
  47. }
  48. return result;
  49. }
  50. }
  51. });