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> <template>
<div class="content-block-title-input"> <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> </div>
</template> </template>
<script>
export default {
props: ['title']
}
</script>
<style scoped lang="scss"> <style scoped lang="scss">
@import "@/styles/_variables.scss"; @import "@/styles/_variables.scss";

View File

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