Todo list demonstrating Vue.js integrated with beautiful Semantic-ui lib.
Last active
March 9, 2017 13:01
-
-
Save mostafabahri/340c0d001375174b50f47fd1bd76ee53 to your computer and use it in GitHub Desktop.
Semantic Todo - Vue.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="ui container top"> | |
<div class="ui raised pink segment center aligned"> | |
<h1 class="ui header">TodoList - Semantic UI + Vue.js</h1> | |
</div> | |
<div class="ui divider"></div> | |
<div class="uialigned two column grid centered stackable" id="app"> | |
<div class="row"> | |
<div class=" column"> | |
<div class="ui segments"> | |
<div class="ui segment" v-for="(todo,index) in todos"> {{todo.name}} <i class="remove icon large" @click="removeTodo(index)"></i></div> | |
</div> | |
</div> | |
</div> | |
<!-- <div class="row"> --> | |
<div class=" column"> | |
<div class="ui action fluid input"> | |
<input type="text" placeholder="Add new todo..." v-model.trim="newItem"> | |
<button class="ui button" @click="addTodo">Add Todo</button> | |
</div> | |
</div> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var todos = [{ | |
name: 'Learn React', | |
done: false | |
}, { | |
name: 'Learn Vue', | |
done: true | |
}, { | |
name: 'Compare the two', | |
done: true | |
}, { | |
name: 'Go crazy', | |
done: true | |
}, | |
]; | |
var vm = new Vue({ | |
el: '#app', | |
data: { | |
todos, | |
newItem: '' | |
}, | |
methods: { | |
removeTodo: function(index) { | |
this.todos.splice(index, 1); | |
}, | |
addTodo: function() { | |
if (this.newItem) { | |
this.todos.push({name: this.newItem,done: false}); | |
this.newItem = ''; | |
} | |
}, | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.top{ | |
margin-top: 2em; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.6/semantic.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment