Toggler component
This commit is contained in:
28
js/components/toggler.js
Normal file
28
js/components/toggler.js
Normal 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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user