Toggler component

This commit is contained in:
Andrew Croce 2018-08-22 11:05:37 -04:00
parent e38bc2fa63
commit eb04321277
2 changed files with 30 additions and 1 deletions

28
js/components/toggler.js Normal file
View File

@ -0,0 +1,28 @@
export default {
name: 'toggler',
data: function () {
return {
isVisible: false
}
},
render: function (createElement) {
return createElement( this.$vnode.data.tag, [
this.$scopedSlots.default({
isVisible: this.isVisible,
toggle: this.toggle
})
])
},
methods: {
toggle: function (e) {
this.isVisible = !this.isVisible
}
},
mounted: function () {
console.log(this)
}
}

View File

@ -8,13 +8,14 @@ import checkboxinput from './components/checkbox_input'
import DetailsOfUse from './components/forms/details_of_use' import DetailsOfUse from './components/forms/details_of_use'
import poc from './components/forms/poc' import poc from './components/forms/poc'
import financial from './components/forms/financial' import financial from './components/forms/financial'
import toggler from './components/toggler'
Vue.use(VTooltip) Vue.use(VTooltip)
const app = new Vue({ const app = new Vue({
el: '#app-root', el: '#app-root',
components: { components: {
toggler,
optionsinput, optionsinput,
textinput, textinput,
checkboxinput, checkboxinput,