acammies
2018-04-05 637b4a50df62739de12a65555522d744147e30da
commit | author | age
991c76 1 <template>
D 2     <md-field>
3       <label>New ToDo</label>
4       <md-input :placeholder="placeholderMsg"
5                 @keyup.enter="newTodoAdded"
6                 v-model="newTodo"
7       ></md-input>
8     </md-field>
9   </template>
10 <script>
a34f1d 11 import EventBus from "@/services/EventBus"
D 12
991c76 13 export default {
D 14   name: "NewTodo",
15   props: {
16     placeholderMsg: String
17   },
18   data () {
19     return {
20       newTodo: ''
21     }
22   },
23   methods: {
24       newTodoAdded (e) {
9e628c 25         console.info('INFO - Adding new todo ', this.newTodo)
D 26         this.newTodo = e.target.value
27         this.$store.dispatch("setNewTodo", this.newTodo)
28         this.$store.dispatch("addTodo")
29         this.$store.dispatch("clearNewTodo")
30         this.newTodo = ''
991c76 31       }
D 32   }
33 };
34 </script>
35
36 <!-- Add "scoped" attribute to limit CSS to this component only -->
37 <style scoped lang="scss">
38
39 </style>