Add title change event hook

This commit is contained in:
Ramon Wenger 2018-09-10 17:13:07 +02:00
parent f07268a627
commit 424e1c7f48
2 changed files with 17 additions and 6 deletions

View File

@ -1,9 +1,16 @@
<template>
<div class="content-block-title-input">
<input placeholder="Titel für Inhaltsblock erfassen" class="content-block-title-input__inputfield skillbox-input">
<input placeholder="Titel für Inhaltsblock erfassen" class="content-block-title-input__inputfield skillbox-input"
v-on:input="$emit('update-title', $event.target.value)">
</div>
</template>
<script>
export default {
props: ['title']
}
</script>
<style scoped lang="scss">
@import "@/styles/_variables.scss";

View File

@ -1,9 +1,6 @@
<template>
<modal>
<content-block-title-input slot="header"></content-block-title-input>
<!--<div>-->
<!--<span v-for="(e, i) in elements" :key="i">{{e.text}}</span>-->
<!--</div>-->
<content-block-title-input slot="header" v-on:update-title="updateTitle" :title="title"></content-block-title-input>
<div v-for="(element, index) in elements" :key="index" class="new-content-block-wizard__element">
<component
class="new-content-block-wizard__element-component"
@ -92,7 +89,6 @@
this._updateProperty(value, index, 'text')
},
changeVideoUrl(value, index) {
console.log('changing url');
this._updateProperty(value, index, 'url')
},
removeElement(index) {
@ -101,6 +97,9 @@
addElement(index) {
this.elements.splice(index + 1, 0, {})
},
updateTitle(title) {
this.title = title;
},
changeType(index, type) {
let el = {
type: type
@ -122,6 +121,7 @@
},
saveContentBlock() {
this.$store.dispatch('saveContentBlock', {
title: this.title,
elements: this.elements
});
}
@ -129,7 +129,11 @@
data() {
return {
title: '',
elements: [
{
type: 'image'
},
{
type: 'video',
url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'