Created
May 11, 2016 17:04
-
-
Save anlek/bd20598692459a10e84b8e9b9467b0bd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<template lang="jade"> | |
#example | |
button(@click="greet") Greet | |
</template> | |
<script> | |
export default { | |
data () { | |
return { | |
// note: changing this line won't causes changes | |
// with hot-reload because the reloaded component | |
// preserves its current state and we are modifying | |
// its initial state. | |
msg: 'Hello World!!?!' | |
} | |
}, | |
methods: { | |
greet: (event) => { | |
// `this` inside methods point to the Vue instance | |
console.log('Hello ' + this.msg + '!') //this is undefined, why???? | |
// `event` is the native DOM event | |
console.log(event.target.tagName) | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment