Last active
June 6, 2016 13:08
-
-
Save sms-system/20872c18caf53c204defd7418c30893a to your computer and use it in GitHub Desktop.
Vue.js Demo
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
<template lang="jade"> | |
#app | |
h1 {{title | uppercase}} | |
ul(v-if="todos.length") | |
li.task( | |
v-for="task in tasks", | |
:class="{ done: task.done }", | |
@click="task.done = !task.done" | |
) {{task.content}} | |
p(v-else) Task List is empty. | |
</template> | |
<script> | |
new Vue({ | |
el: '#app', | |
data: { | |
title: 'Todo List', | |
tasks: [ | |
{ done: 1, content: 'Task 1' }, | |
{ done: 0, content: 'Another task'} | |
] | |
} | |
}) | |
</script> | |
<style lang="stylus"> | |
#app | |
width 500px | |
margin 0 auto | |
.task | |
cursor pointer | |
margin 10px 0 | |
&.done | |
color #7f8c8d | |
text-decoration line-through | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment