Hook up details of use form to Vue to show/hide migration fields

This commit is contained in:
Patrick Smith
2018-08-10 10:53:46 -04:00
parent 687af77e33
commit 86391e4ab5
3 changed files with 73 additions and 22 deletions

View File

@@ -0,0 +1,43 @@
import textinput from '../text_input'
import optionsinput from '../options_input'
export default {
name: 'details-of-use',
components: {
textinput,
optionsinput,
},
props: {
initialData: {
type: Object,
default: () => ({})
}
},
data: function () {
return {
jedi_migration: this.initialData.jedi_migration
}
},
mounted: function () {
this.$root.$on('field-change', this.handleFieldChange)
},
computed: {
isJediMigration: function () {
return this.jedi_migration === 'yes'
}
},
methods: {
handleFieldChange: function (event) {
const { value, name } = event
if (typeof this[name] !== undefined) {
this[name] = value
}
},
}
}

View File

@@ -3,12 +3,14 @@ import Vue from 'vue/dist/vue'
import optionsinput from './components/options_input'
import textinput from './components/text_input'
import DetailsOfUse from './components/forms/details_of_use'
const app = new Vue({
el: '#app-root',
components: {
optionsinput,
textinput,
DetailsOfUse,
},
methods: {
closeModal: function(name) {