Skip to content

Commit

Permalink
Fix bug with event bus
Browse files Browse the repository at this point in the history
  • Loading branch information
arswaw committed Dec 12, 2018
1 parent 83b3283 commit 1ea1615
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/todo-editor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const bus = new Vue();
import { bus } from '../scripts.js'

const TodoEditor = {
template: '#todo-editor-template',
Expand Down
2 changes: 1 addition & 1 deletion components/todo-list.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const bus = new Vue();
import { bus } from '../scripts.js'

const TodoList = {
template: '#todo-list-template',
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ <h1>Your To-Do's</h1>
<div class="btn-group" role="group" aria-label="Edit delete group">
<span class="mr-3">{{todo.created}} </span>

<select class="d-md-none d-lg-block" @change="action(actionValue, index, todo)" v-model="actionValue">
<select class="d-block d-md-none" @change="action(actionValue, index, todo)" v-model="actionValue">
<option value="done">Done</option>
<option value="edit">Edit</option>
<option value="delete">Delete</option>
</select>

<div class="d-none d-sm-block">
<div class="d-none d-md-block">
<button class="btn btn-success mr-2 rounded" @click="changeState(index)">Done</button>

<button type="button" @click="showTodoEditor(todo, index)" class="btn btn-primary mr-2 rounded">Edit</button>
Expand Down
7 changes: 5 additions & 2 deletions scripts.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { TodoEditor } from './components/todo-editor.js'
import { TodoList } from './components/todo-list.js'

const bus = new Vue();

new Vue({
el: '#app',
components: {
Expand All @@ -9,9 +11,10 @@ new Vue({
},
template: `
<div class="container">
<todo-editor></todo-editor>
<todo-list></todo-list>
</div>
`
})
})

export { bus }

0 comments on commit 1ea1615

Please sign in to comment.