mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-06 05:57:35 +08:00
update examples
This commit is contained in:
parent
de6459f8d6
commit
285d4ae1f7
@ -31,9 +31,10 @@ var demo = new Vue({
|
||||
|
||||
created: function () {
|
||||
this.fetchData()
|
||||
this.$watch('currentBranch', function () {
|
||||
this.fetchData()
|
||||
})
|
||||
},
|
||||
|
||||
watch: {
|
||||
currentBranch: 'fetchData'
|
||||
},
|
||||
|
||||
filters: {
|
||||
|
@ -59,8 +59,7 @@ var app = new Vue({
|
||||
|
||||
// methods
|
||||
methods: {
|
||||
addUser: function (e) {
|
||||
e.preventDefault()
|
||||
addUser: function () {
|
||||
if (this.isValid) {
|
||||
Users.push(this.newUser)
|
||||
this.newUser.name = ''
|
||||
|
@ -10,12 +10,12 @@
|
||||
<body>
|
||||
<div id="app">
|
||||
<ul>
|
||||
<li class="user" v-for="user in users" v-transition>
|
||||
<li class="user" v-for="user in users" transition>
|
||||
<span>{{user.name}} - {{user.email}}</span>
|
||||
<button v-on="click:removeUser(user)">X</button>
|
||||
<button v-on:click="removeUser(user)">X</button>
|
||||
</li>
|
||||
</ul>
|
||||
<form id="form" v-on="submit:addUser">
|
||||
<form id="form" v-on:submit.prevent="addUser">
|
||||
<input v-model="newUser.name">
|
||||
<input v-model="newUser.email">
|
||||
<input type="submit" value="Add User">
|
||||
|
Loading…
Reference in New Issue
Block a user