Created
September 26, 2017 02:57
-
-
Save skvggor/a3e4d1f3c1721f00bd70cc27c256fc72 to your computer and use it in GitHub Desktop.
Organizing events
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
const Vue = require('../../node_modules/vue/dist/vue.common.js'); | |
const App = new Vue({ | |
delimiters: ['${', '}'], | |
el: '#app', | |
data: { | |
message: 'Default message', | |
greetings: { | |
hi: function() { | |
return 'hi'; | |
}, | |
hello: function() { | |
return 'hello'; | |
} | |
} | |
}, | |
methods: { | |
say: function(option) { | |
this.message = this.greetings[option](); | |
} | |
} | |
}); |
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
<main id="app" class="home"> | |
<a @click.prevent="say('hi')" href="#">Click me - Hi!</a> | |
<br> | |
<a @click.prevent="say('hello')" href="#">Click me - Hello!</a> | |
<h1>${ message }</h1> | |
</main> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment