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>
|
||||
</p>
|
||||
<p>
|
||||
a
|
||||
<b-button type="is-danger" class="mt-3" v-on:click="$emit('deletehlava', index)" expanded>Smazat hlavu</b-button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@ -29,7 +29,7 @@
|
||||
<script>
|
||||
export default {
|
||||
name: "Hlava",
|
||||
props: ['title', 'text'],
|
||||
props: ['title', 'text', 'index'],
|
||||
data: () => {
|
||||
return {
|
||||
isactive: false
|
||||
@ -40,6 +40,8 @@ export default {
|
||||
this.isactive = true;
|
||||
},
|
||||
makeinactive: function () {
|
||||
this.$emit('update:text', this.text)
|
||||
this.$emit('update:title', this.title)
|
||||
this.isactive = false;
|
||||
}
|
||||
},
|
||||
@ -57,20 +59,6 @@ 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@
|
||||
{{ zaloba.title }}
|
||||
</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>
|
||||
<b-button type="is-light" class="mt-3" v-on:click="addHlava" expanded>+</b-button>
|
||||
</div>
|
||||
@ -77,6 +77,9 @@ export default {
|
||||
methods: {
|
||||
addHlava: function () {
|
||||
this.zaloba.hlavy.push({"title":"","text":""})
|
||||
},
|
||||
deleteHlava: function (index) {
|
||||
this.zaloba.hlavy.splice(index, 1)
|
||||
}
|
||||
},
|
||||
data: () => {
|
||||
|
Loading…
Reference in New Issue
Block a user