Skip to content

Instantly share code, notes, and snippets.

@paltman
Created July 4, 2018 19:45
Show Gist options
  • Save paltman/998ccf18082c669f51f331a1098090ee to your computer and use it in GitHub Desktop.
Save paltman/998ccf18082c669f51f331a1098090ee to your computer and use it in GitHub Desktop.
<template>
<div class="setup-form">
<b-form-group description="The title of your page" label="Page Title" label-for="title">
<b-form-input id="title" v-model.trim="title"></b-form-input>
</b-form-group>
<div class="mt-5">
<b-button variant="primary" :block="true" @click="onUpdate">Update</b-button>
</div>
</div>
</template>
<script>
export default {
data () {
return {
_title: ''
}
},
methods: {
onUpdate () {
console.log(this._title); // dispatch action to push title back to API here
}
},
computed: {
title: {
get () {
if (this._title) {
return this._title;
}
return this.$store.getters.title
},
set (value) {
this._title = value;
}
}
},
name: 'setup-tab-form'
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment