This commit is contained in:
Šimon Jan Šustek 2021-01-23 01:34:13 +01:00
parent 6e8cb3c8b6
commit 4465f06b73
2 changed files with 24 additions and 2 deletions

View File

@ -15,6 +15,9 @@
<p>
<b-input placeholder="Text hlavy" v-model="text" type="textarea"></b-input>
</p>
<p>
a
</p>
</div>
</div>
</template>
@ -54,6 +57,20 @@ export default {
} else {
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)
}
}
}

View File

@ -48,9 +48,9 @@
{{ zaloba.title }}
</div>
<div>
<Hlava v-for="hlava in zaloba.hlavy" :key="hlava.nazev" v-bind:title="hlava.nazev" v-bind:text="hlava.text" />
<Hlava v-for="hlava in zaloba.hlavy" :key="hlava.nazev" v-bind:title.sync="hlava.nazev" v-bind:text.sync="hlava.text" />
</div>
<b-button type="is-light" class="mt-3" expanded>+</b-button>
<b-button type="is-light" class="mt-3" v-on:click="addHlava" expanded>+</b-button>
</div>
</div>
</template>
@ -74,6 +74,11 @@ export default {
NavBar,
Hlava
},
methods: {
addHlava: function () {
this.zaloba.hlavy.push({"title":"","text":""})
}
},
data: () => {
return {
zaloba: {