File tree 1 file changed +20
-12
lines changed
1 file changed +20
-12
lines changed Original file line number Diff line number Diff line change @@ -489,11 +489,15 @@ Here's a complete example of a simple todo list:
489
489
490
490
``` html
491
491
<div id =" todo-list-example" >
492
- <input
493
- v-model =" newTodoText"
494
- v-on:keyup.enter =" addNewTodo"
495
- placeholder =" Add a todo"
496
- >
492
+ <form v-on:submit.prevent =" addNewTodo" >
493
+ <label for =" new-todo" >Add a todo</label >
494
+ <input
495
+ v-model =" newTodoText"
496
+ id =" new-todo"
497
+ placeholder =" E.g. Feed the cat"
498
+ >
499
+ <button >Add</button >
500
+ </form >
497
501
<ul >
498
502
<li
499
503
is =" todo-item"
@@ -513,7 +517,7 @@ Vue.component('todo-item', {
513
517
template: ' \
514
518
<li>\
515
519
{{ title }}\
516
- <button v-on:click="$emit(\' remove\' )">X </button>\
520
+ <button v-on:click="$emit(\' remove\' )">Remove </button>\
517
521
</li>\
518
522
' ,
519
523
props: [' title' ]
@@ -553,11 +557,15 @@ new Vue({
553
557
554
558
{% raw %}
555
559
<div id =" todo-list-example " class =" demo " >
556
- <input
557
- v-model="newTodoText"
558
- v-on: keyup .enter="addNewTodo"
559
- placeholder="Add a todo"
560
- >
560
+ <form v-on:submit.prevent =" addNewTodo " >
561
+ <label for="new-todo">Add a todo</label>
562
+ <input
563
+ v-model="newTodoText"
564
+ id="new-todo"
565
+ placeholder="E.g. Feed the cat"
566
+ >
567
+ <button>Add</button>
568
+ </form >
561
569
<ul >
562
570
<li
563
571
is="todo-item"
@@ -573,7 +581,7 @@ Vue.component('todo-item', {
573
581
template: ' \
574
582
<li>\
575
583
{{ title }}\
576
- <button v-on:click="$emit(\' remove\' )">X </button>\
584
+ <button v-on:click="$emit(\' remove\' )">Remove </button>\
577
585
</li>\
578
586
' ,
579
587
props: [' title' ]
You can’t perform that action at this time.
0 commit comments