vue-learning/hello/app.js

25 lines
617 B
JavaScript
Raw Normal View History

2019-11-09 11:09:41 +00:00
Vue.component('todo-item', {
props: ['todo'],
template: '<li>{{ todo.text }}</li>'
})
var app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!',
showspan: true,
todos: [
{ id: 1, text: 'Learn JavaScript' },
{ id: 2, text: 'Learn Vue' },
{ id: 3, text: 'Build something awesome' }
],
label: 'You loaded this page on ' + new Date().toLocaleString()
},
methods: {
reverseMessage: function () {
this.message = this.message.split('').reverse().join('')
}
}
})