Created
May 4, 2017 07:54
-
-
Save vuejsdevelopers/da61b77f334aedefcf9263b581471876 to your computer and use it in GitHub Desktop.
7 Ways To Define A Component Template in Vue.js - Snippet 06
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vue.component('my-checkbox', { | |
data() { | |
return { | |
checked: false, | |
title: 'Check me' | |
} | |
}, | |
methods: { | |
check() { | |
this.checked = !this.checked; | |
} | |
}, | |
render() { | |
return <div class="checkbox-wrapper" onClick={ this.check }> | |
<div class={{ checkbox: true, checked: this.checked }}></div> | |
<div class="title">{ this.title }</div> | |
</div> | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment