WIP
This commit is contained in:
parent
4465f06b73
commit
97e30fa4c6
@ -16,7 +16,7 @@
|
|||||||
<b-input placeholder="Text hlavy" v-model="text" type="textarea"></b-input>
|
<b-input placeholder="Text hlavy" v-model="text" type="textarea"></b-input>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
a
|
<b-button type="is-danger" class="mt-3" v-on:click="$emit('deletehlava', index)" expanded>Smazat hlavu</b-button>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -29,7 +29,7 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "Hlava",
|
name: "Hlava",
|
||||||
props: ['title', 'text'],
|
props: ['title', 'text', 'index'],
|
||||||
data: () => {
|
data: () => {
|
||||||
return {
|
return {
|
||||||
isactive: false
|
isactive: false
|
||||||
@ -40,6 +40,8 @@ export default {
|
|||||||
this.isactive = true;
|
this.isactive = true;
|
||||||
},
|
},
|
||||||
makeinactive: function () {
|
makeinactive: function () {
|
||||||
|
this.$emit('update:text', this.text)
|
||||||
|
this.$emit('update:title', this.title)
|
||||||
this.isactive = false;
|
this.isactive = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -57,20 +59,6 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
return this.text
|
return this.text
|
||||||
}
|
}
|
||||||
},
|
|
||||||
textOut: function () {
|
|
||||||
return this.text
|
|
||||||
},
|
|
||||||
titleOut: function () {
|
|
||||||
return this.title
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
titleOut: function (oldVal,newVal) {
|
|
||||||
this.$emit('update:title', newVal)
|
|
||||||
},
|
|
||||||
textOut: function (oldVal,newVal) {
|
|
||||||
this.$emit('update:text', newVal)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
{{ zaloba.title }}
|
{{ zaloba.title }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Hlava v-for="hlava in zaloba.hlavy" :key="hlava.nazev" v-bind:title.sync="hlava.nazev" v-bind:text.sync="hlava.text" />
|
<Hlava v-for="(hlava,index) in zaloba.hlavy" :key="hlava.nazev" v-bind:index="index" v-bind:title.sync="hlava.nazev" v-bind:text.sync="hlava.text" v-on:deletehlava="deleteHlava" />
|
||||||
</div>
|
</div>
|
||||||
<b-button type="is-light" class="mt-3" v-on:click="addHlava" expanded>+</b-button>
|
<b-button type="is-light" class="mt-3" v-on:click="addHlava" expanded>+</b-button>
|
||||||
</div>
|
</div>
|
||||||
@ -77,6 +77,9 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
addHlava: function () {
|
addHlava: function () {
|
||||||
this.zaloba.hlavy.push({"title":"","text":""})
|
this.zaloba.hlavy.push({"title":"","text":""})
|
||||||
|
},
|
||||||
|
deleteHlava: function (index) {
|
||||||
|
this.zaloba.hlavy.splice(index, 1)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data: () => {
|
data: () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user