<template>
<ul>
<li v-for='todo in list'>
<label v-bind:class="{ done : todo.done }" >
<input type="checkbox" v-model="todo.done"/>
{{todo.title}}
</label>
</li>
</ul>
</template>
<script>
export default {
props: {
initList: {
type: Array
}
},
data () {
return {
list: []
}
},
events: {
add (input) {
if (!input) return false
this.list.unshift({
title: input,
done: false
})
}
}
}
</script>
<style lang="less" scoped>
ul {
margin-left: 2rem;
padding: 0;
.done {
text-decoration: line-through;
}
}
</style>
<template>
<h1>{{username}}'s Todo List</h1>
<form v-on:submit="add" v-on:submit.prevent>
<input type="text" v-model="input"/>
<input type="submit" value='add' />
</form>
</template>
<script>
export default {
props: {
username: {
type: String,
default: 'Unnamed'
}
},
data () {
return {
input: ''
}
},
methods: {
add () {
this.$dispatch('add', this.input)
this.input = ''
}
}
}
</script>
<template>
<div id="todo">
<todo-form username='Lily'></todo-form>
<todo-list></todo-list>
</div>
</template>
<script>
import Form from './Form.vue'
import List from './List.vue'
export default {
components: {
'todo-form': Form,
'todo-list': List
},
events: {
add (input) {
this.$broadcast('add', input)
}
}
}
</script>
<style>
</style>
<template>
<todo></todo>
</template>
<script>
import Todo from './components/Todo.vue'
export default {
components: {
'todo': Todo
}
}
</script>
<style>
</style>
export default {
list: [
],
add (title) {
if (!title) return
this.list.unshift({
title: title,
done: false
})
}
}
import Store from '../Store.js'
export default {
props: {
initList: {
type: Array
}
},
data () {
return Store
}
}
import Store from '../Store.js'
export default {
props: {
username: {
type: String,
default: 'Unnamed'
}
},
data () {
return {
input: ''
}
},
methods: {
add () {
Store.add(this.input)
this.input = ''
}
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有