Skip to content

Commit 4776249

Browse files
committed
chore: refactor trim in examples
1 parent f1eb663 commit 4776249

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

packages/vuexfire/examples/TodoApp/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</li>
2323
</ul>
2424
<form @submit.prevent="addTodo">
25-
<input v-model="newTodo" /> <button>Add #{{ items.length }}</button>
25+
<input v-model.trim="newTodo" /> <button>Add #{{ items.length }}</button>
2626
</form>
2727

2828
<br />
@@ -68,7 +68,7 @@
6868
this.source.doc(id).delete()
6969
},
7070
addTodo: function() {
71-
if (this.newTodo.trim()) {
71+
if (this.newTodo) {
7272
this.source.add({
7373
text: this.newTodo,
7474
})

packages/vuexfire/examples/TodoApp/modules.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,12 @@
6060
itemsRef.doc(id).delete()
6161
},
6262
addTodo: function() {
63-
if (this.newTodo.length < 1) return
64-
itemsRef.add({
65-
text: this.newTodo
66-
})
67-
this.newTodo = ''
63+
if (this.newTodo) {
64+
itemsRef.add({
65+
text: this.newTodo,
66+
})
67+
this.newTodo = ''
68+
}
6869
},
6970
},
7071

0 commit comments

Comments
 (0)