Skip to content

Commit b3d30f6

Browse files
committed
examples source link moved to top of page
1 parent 1899992 commit b3d30f6

12 files changed

+54
-24
lines changed

website/docs/.vuepress/components/Example09DynamicAddRemove.vue

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<template>
22
<div>
3+
<div class="layoutJSON">
4+
Displayed as <code>[x, y, w, h]</code>:
5+
<div class="columns">
6+
<div class="layoutItem" v-for="item in layout" :key="item.i">
7+
<b>{{item.i}}</b>: [{{item.x}}, {{item.y}}, {{item.w}}, {{item.h}}]
8+
</div>
9+
</div>
10+
</div>
311
<button @click="addItem">Add an item dynamically</button>
412
<input type="checkbox" v-model="draggable" /> Draggable
513
<input type="checkbox" v-model="resizable" /> Resizable
@@ -50,7 +58,7 @@ export default {
5058
}
5159
},
5260
mounted() {
53-
this.$gridlayout.load();
61+
// this.$gridlayout.load();
5462
this.index = this.layout.length;
5563
},
5664
methods: {
@@ -67,13 +75,29 @@ export default {
6775
this.index++;
6876
},
6977
removeItem: function (val) {
70-
this.layout = this.layout.filter((item) => item.i !== val);
78+
const index = this.layout.map(item => item.i).indexOf(val);
79+
this.layout.splice(index, 1);
7180
},
7281
}
7382
}
7483
</script>
7584

76-
<style scoped>
85+
<style>
86+
.layoutJSON {
87+
background: #ddd;
88+
border: 1px solid black;
89+
margin-top: 10px;
90+
padding: 10px;
91+
}
92+
93+
.columns {
94+
-moz-columns: 120px;
95+
-webkit-columns: 120px;
96+
columns: 120px;
97+
}
98+
99+
/*************************************/
100+
77101
.remove {
78102
position: absolute;
79103
right: 2px;

website/docs/.vuepress/public/examples/09-dynamic-add-remove.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ new Vue({
4040
this.index++;
4141
},
4242
removeItem: function (val) {
43-
this.layout = this.layout.filter((item) => item.i !== val);
43+
const index = this.layout.map(item => item.i).indexOf(val);
44+
this.layout.splice(index, 1);
4445
},
4546
},
4647
});

website/docs/guide/01-basic.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# 01 - Basic
22

3+
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example01Basic.vue)
4+
35
<ClientOnly>
46
<Example01Basic></Example01Basic>
57
</ClientOnly>
68

7-
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example01Basic.vue)

website/docs/guide/02-events.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# 02 - Move and resize events
22

3+
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example02Events.vue)
4+
35
<ClientOnly>
46
<Example02Events></Example02Events>
57
</ClientOnly>
6-
7-
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example02Events.vue)

website/docs/guide/03-multiple-grids.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# 03 - Multiple grids
22

3+
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example03MultipleGrids.vue)
4+
35
<ClientOnly>
46
<Example03MultipleGrids></Example03MultipleGrids>
57
</ClientOnly>
68

7-
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example03MultipleGrids.vue)

website/docs/guide/04-allow-ignore.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ Ignore drag on certain elements and allow on others.
44

55
Click and drag the dots on the corner of each item to reposition
66

7+
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example04AllowIgnore.vue)
8+
79
<ClientOnly>
810
<Example04AllowIgnore></Example04AllowIgnore>
911
</ClientOnly>
1012

11-
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example04AllowIgnore.vue)

website/docs/guide/05-mirrored.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# 05 - Mirrored grid layout
22

3+
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example05Mirrored.vue)
4+
35
<ClientOnly>
46
<Example05Mirrored></Example05Mirrored>
57
</ClientOnly>
68

7-
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example05Mirrored.vue)

website/docs/guide/06-responsive.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# 06 - Responsive
22

3+
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example06Responsive.vue)
4+
35
<ClientOnly>
4-
<iframe style="border:0;width: 100%;height:3000px;" src="../examples/06-responsive.html"></iframe>
5-
<!--Example06Responsive></Example06Responsive-->
6+
<!--iframe style="border:0;width: 100%;height:3000px;" src="../examples/06-responsive.html"></iframe-->
7+
<Example06Responsive></Example06Responsive>
68
</ClientOnly>
79

8-
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example06Responsive.vue)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# 07 - Prevent Collision
22

3+
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example07PreventCollision.vue)
4+
35
<ClientOnly>
46
<!--iframe style="border:0;width: 100%;height:1000px;" src="../examples/07-prevent-collision.html"></iframe-->
57
<Example07PreventCollision></Example07PreventCollision>
68
</ClientOnly>
7-
8-
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example07PreventCollision.vue)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# 08 - Responsive with predefined layouts
22

3+
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example08ResponsivePredefinedLayouts.vue)
4+
35
<ClientOnly>
46
<Example08ResponsivePredefinedLayouts></Example08ResponsivePredefinedLayouts>
57
</ClientOnly>
6-
7-
[View source](https://github.com/jbaysolutions/vue-grid-layout/blob/master/website/docs/.vuepress/components/Example08ResponsivePredefinedLayouts.vue)

0 commit comments

Comments
 (0)