vue---todolist
来源:互联网 发布:mac jenkins 配置文件 编辑:程序博客网 时间:2024/05/17 17:57
Vue 学习 作业一 todolist
模板用的是todomvc的模板
todo.js
const filters = { all (todoList) { return todoList }, active (todoList) { return todoList.filter((todo) => { return !todo.completed }) }, completed (todoList) { return todoList.filter((todo) => { return todo.completed }) }}var app = new Vue({ el: '.todoapp', data: { // view newTodo: '', // model todoList: [], visibility: 'all', // 'all', 'active', 'completed' editingTodo: null }, methods: { add () { let value = this.newTodo if (!value) { return } this.todoList.push({ todo: value, completed: false }) }, deleteTodo (todo) { this.todoList.splice(this.todoList.indexOf(todo), 1) }, editTodo (todo) { this.beforeEdit = todo.todo this.editingTodo = todo }, finishEdit (todo) { if (!this.editingTodo) { return } this.editingTodo = null todo.todo = todo.todo.trim() if (!todo.todo) { this.deleteTodo(todo) } }, cancelEdit (todo) { this.editingTodo = null todo.todo = this.beforeEdit }, clearCompleted () { this.todoList = filters.actvie(this.todos) } }, computed: { todolen () { return this.todoList.length }, filteredTodos () { return filters[this.visibility](this.todoList) }, remaining () { return filters.active(this.todoList).length }, allCompleted: { get: function () { return this.remaining === 0 }, set: function (value) { this.todoList.forEach(function (todo) { todo.completed = value }) } } }, watch: { todolen (newValue, oldValue) { newValue === (oldValue + 1) && (this.newTodo = '') } }, filters: { pluralize: function (n) { return n === 1 ? 'item' : 'items' } }, directives: { 'focus': function (el, value) { if (value) { console.log(value) el.focus() } } }})
0 0
- vue---todolist
- vue-todolist-demo
- Vue之ToDoList实战
- vue.js实例todoList
- Vue之todoList
- vue-简单的todolist
- Vue实现简单ToDoList
- vue写todolist
- ToDoList(Vue示例)
- vue实现todolist的demo
- 二四、vue实现todolist
- vue.js 练手--简单ToDoList
- vue.js实现简单todolist
- vue简单实例(todolist)
- vue-todoList-demo with localstorage
- Vue入门02-vue实现ToDoList
- 用vue写todolist单页应用
- vue实现简易留言板(todolist)
- 二分查找算法的递归与非递归实现
- 解决ueditor图片上传的弹出窗口被遮盖问题
- 算法导论(implementation of quick sort)
- 如何获取Android手机连接网络的当前局域网IP
- Boost install on Ubuntu
- vue---todolist
- Map集合的两种遍历方式
- [SMOJ1809]乌龟棋
- NYOJ--19--next_permutation()--擅长排列的小明
- jqgrid清楚单元格内容
- 58同城 iOS客户端组件化演变历程---公司也正朝着这个方向努力
- Linux curl命令详解
- Set up the Virtual switch and Virtual adapter in Windows 2012R2
- Python 机器学习过程小结