Skip to content
Snippets Groups Projects
Commit 0e6cb863 authored by Julian's avatar Julian
Browse files

Make data of example 4 a function

parent 193777ff
No related branches found
No related tags found
1 merge request!2Resolve "Implement basic functionality"
...@@ -74,18 +74,34 @@ import NumberCounter from "./components/NumberCounter.vue"; ...@@ -74,18 +74,34 @@ import NumberCounter from "./components/NumberCounter.vue";
</drag-grid> </drag-grid>
</div> </div>
<div class="ttt-container"> <div class="ttt-container">
<label> <div>
Lesson 1 has length: {{ lesson1Length }} <label>
<input type="range" v-model="lesson1Length" min="1" max="5" step="1" /> Lesson 1 has length: {{ lesson1Length }}
</label> <input
<label> type="range"
Lesson grid has width: {{ lesson1Cols }} v-model="lesson1Length"
<input type="range" v-model="lesson1Cols" min="2" max="5" step="1" /> min="1"
</label> max="5"
<label> step="1"
Lesson grid has height: {{ lesson1Rows }} />
<input type="range" v-model="lesson1Rows" min="6" max="10" step="1" /> </label>
</label> <input type="text" v-model="lessonData.lesson1" />
</div>
<div>
<label>
Lesson grid has width: {{ lesson1Cols }}
<input type="range" v-model="lesson1Cols" min="2" max="5" step="1" />
</label>
<input type="text" v-model="lessonData.lesson2" />
</div>
<div>
<label>
Lesson grid has height: {{ lesson1Rows }}
<input type="range" v-model="lesson1Rows" min="6" max="10" step="1" />
<input type="text" v-model="lessonData.lesson3.inside" />
<input type="text" v-model="lessonData.lesson3.outside" />
</label>
</div>
<drag-grid <drag-grid
:value="lessons1" :value="lessons1"
...@@ -207,6 +223,14 @@ export default { ...@@ -207,6 +223,14 @@ export default {
lesson3X: -1, lesson3X: -1,
lesson3Y: -1, lesson3Y: -1,
lesson3inPlan: false, lesson3inPlan: false,
lessonData: {
lesson1: "Nothing",
lesson2: "Hallo",
lesson3: {
inside: "This is lesson 3 inside the plan",
outside: "This is lesson3 outside of the plan",
},
},
}; };
}, },
computed: { computed: {
...@@ -222,7 +246,9 @@ export default { ...@@ -222,7 +246,9 @@ export default {
w: 1, w: 1,
h: this.lesson1Length, h: this.lesson1Length,
key: "lesson1", key: "lesson1",
data: {}, data: {
text: this.lessonData.lesson1,
},
}, },
{ {
x: (grid) => { x: (grid) => {
...@@ -234,7 +260,9 @@ export default { ...@@ -234,7 +260,9 @@ export default {
w: 1, w: 1,
h: parseInt(this.lesson1Length) + 1, h: parseInt(this.lesson1Length) + 1,
key: "lesson2", key: "lesson2",
data: {}, data: {
text: this.lessonData.lesson2,
},
}, },
{ {
x: (grid) => { x: (grid) => {
...@@ -252,7 +280,14 @@ export default { ...@@ -252,7 +280,14 @@ export default {
w: 1, w: 1,
h: parseInt(this.lesson1Length) + 1, h: parseInt(this.lesson1Length) + 1,
key: "lesson3", key: "lesson3",
data: {}, data: (grid) => {
return {
text:
grid.gridId === "lesson-storage"
? this.lessonData.lesson3.outside
: this.lessonData.lesson3.inside,
};
},
}, },
]; ];
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment