Vue.js based Todo list
How do I make an vue.js based todo list?
What is a vue.js based todo list? How do you make a vue.js based todo list? This script and codes were developed by Kasper Mikiewicz on 21 November 2022, Monday.
Vue.js based Todo list - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Vue.js based Todo list</title> <script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
<link rel="stylesheet" src="//normalize-css.googlecode.com/svn/trunk/normalize.css" />
<script src="https://vuejs.org/js/vue.min.js"></script>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ * { box-sizing: border-box;
}
body { background: #fff; padding: 1em; font-family: Arial; font-size: 14px; color: #666;
}
.lists { margin: 0 0 10px 0; padding: 0;
}
.lists > * { display: inline-block; cursor: pointer;
}
.lists > * + * { margin-left: 15px;
}
.lists .active { font-weight: bold;
}
.tasks { border-top: 1px solid #eee; list-style: none; padding: 0;
}
.tasks > li { transition: opacity .25s ease; border-bottom: 1px solid #eee; -webkit-user-select: none;
}
.tasks > li:focus { outline: none; background: #f4f4f4;
}
.task { padding: 12px 26px;
}
.task[data-level="1"] { margin-left: 15px;
}
.task[data-level="2"] { margin-left: 30px;
}
.task[data-level="3"] { margin-left: 45px;
}
.task.done { color: #ccc;
}
.task__content { border: none; color: inherit; display: inline-block; cursor: pointer; background: none; width: 100%;
}
.task__content:focus { cursor: text; color: #444; outline: none;
}
.task__check { cursor: pointer; float: left; margin-left: -20px; z-index: 1; position: relative;
}
.task__check:before { content: '\f096'; color: #999; vertical-align: middle; width: 20px; display: inline-block;
}
.done .task__check { color: #ccc;
}
.done .task__check:before { color: #ccc; content: '\f046';
}
.task__remove { cursor: pointer; margin-right: -20px; float: right;
}
.text-input { width: 100%; border: 1px solid #ccc; padding: 8px; border-radius: 3px;
}
.text-input:focus { outline: none; border-color: #888;
}
.shortcuts { margin: 30px 0; padding: 0; font-size: 12px; list-style-type: none; line-height: 1.5;
}
.shortcuts > :first-child { margin-bottom: 15px; color: #888;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <script type="text/x-template" id="task"> <li v-repeat="tasks | filterBy list " v-class="done: completed" v-on=" keyup:focusPrevTask(this) | key up, keyup:focusNextTask(this) | key down, keyup:indentTask(this) | key right, keyup:unindentTask(this) | key left, keyup:focusTask(this) | key enter, keyup:toggleTask(this) | key 32, keyup:removeTask(this) | key delete" data-level="{{ level }}" tabindex="{{$index + 1}}" class="task"> <i v-on="click: toggleTask(this)" class="fa task__check"></i> <i v-on="click:removeTask(this)" class="fa fa-times task__remove"></i> <input v-on="focus:editing = true, blur :doneEdit(this, $event), keyup:doneEdit(this, $event) | key enter, keyup:cancelEdit(this, $event) | key esc" tabindex="-1" value="{{ content }}" class="task__content"> </li>
</script>
<div id="app"> <ul class="lists"> <li v-repeat="lists" v-on="click: list = this.slug" v-class="active: list == this.slug" > {{ name }} </li> </ul> <ul class="tasks" v-component="task" v-with="tasks: tasks, editing: editing, list: list"></ul> <input class="text-input" type="text" placeholder="New task" v-model="newTask" v-on="keyup:addTask | key enter">
</div>
<ul class="shortcuts"> <li><b>Shortcuts:</b></li> <li><b>Up/Shift+Tab</b> - Previous task</li> <li><b>Down/Tab</b> - Next task</li> <li><b>Left</b> - Unindent task</li> <li><b>Right</b> - Indent task</li> <li><b>Enter</b> - Edit selected task / Save changes</li> <li><b>Esc</b> - Cancel edit</li> <li><b>Del</b> - Remove task</li>
</ul> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://unpkg.com/[email protected]'></script> <script src="js/index.js"></script>
</body>
</html>
Vue.js based Todo list - Script Codes CSS Codes
* { box-sizing: border-box;
}
body { background: #fff; padding: 1em; font-family: Arial; font-size: 14px; color: #666;
}
.lists { margin: 0 0 10px 0; padding: 0;
}
.lists > * { display: inline-block; cursor: pointer;
}
.lists > * + * { margin-left: 15px;
}
.lists .active { font-weight: bold;
}
.tasks { border-top: 1px solid #eee; list-style: none; padding: 0;
}
.tasks > li { transition: opacity .25s ease; border-bottom: 1px solid #eee; -webkit-user-select: none;
}
.tasks > li:focus { outline: none; background: #f4f4f4;
}
.task { padding: 12px 26px;
}
.task[data-level="1"] { margin-left: 15px;
}
.task[data-level="2"] { margin-left: 30px;
}
.task[data-level="3"] { margin-left: 45px;
}
.task.done { color: #ccc;
}
.task__content { border: none; color: inherit; display: inline-block; cursor: pointer; background: none; width: 100%;
}
.task__content:focus { cursor: text; color: #444; outline: none;
}
.task__check { cursor: pointer; float: left; margin-left: -20px; z-index: 1; position: relative;
}
.task__check:before { content: '\f096'; color: #999; vertical-align: middle; width: 20px; display: inline-block;
}
.done .task__check { color: #ccc;
}
.done .task__check:before { color: #ccc; content: '\f046';
}
.task__remove { cursor: pointer; margin-right: -20px; float: right;
}
.text-input { width: 100%; border: 1px solid #ccc; padding: 8px; border-radius: 3px;
}
.text-input:focus { outline: none; border-color: #888;
}
.shortcuts { margin: 30px 0; padding: 0; font-size: 12px; list-style-type: none; line-height: 1.5;
}
.shortcuts > :first-child { margin-bottom: 15px; color: #888;
}
Vue.js based Todo list - Script Codes JS Codes
Vue.component('task', { template: '#task', methods: { toggleTask: function(task) { if( ! this.editing) { task.completed = !task.completed; } }, focusTask: function(task) { if(! this.editing) { var $input = $(task.$el).find('.task__content').focus(); $input.val($input.val()); } else { this.editing = false; } }, focusPrevTask: function(task) { $(task.$el).prev().focus(); }, focusNextTask: function(task) { $(task.$el).next().focus(); }, unindentTask: function(task) { if( ! this.editing) { task.$el.setAttribute('data-level', task.level <= 0 ? 0 : --task.level); } }, indentTask: function(task) { if( ! this.editing) { task.$el.setAttribute('data-level', task.level >= 3 ? 3 : ++task.level); } }, doneEdit: function(task, e) { e.stopPropagation(); var value = e.target.value.trim(); if (value) { task.content = value; } else { e.target.value = task.content; } this.editing = false; task.$el.focus(); }, cancelEdit: function(task, e) { e.target.value = task.content; task.$el.focus(); this.editing = false; }, removeTask: function (task) { if( ! this.editing) { this.tasks.$remove(task.$data); } }, }
});
var lists = [ { name: 'Private', slug: 'private' }, { name: 'Home', slug: 'home' }
];
var tasks = [ { content: 'Laundry', list: 'home', completed: false, index: 31, level: 0, }, { content: 'Some private job', list: 'private', completed: true, index: 3, level: 0 }, { content: 'Another private job', list: 'private', completed: false, index: 2, level: 1, }
];
var app = new Vue({ el: '#app', data: { editing: false, list: lists[0] ? lists[0].slug : 'addList', lists: lists, tasks: tasks, }, methods: { addTask: function() { var value = this.newTask && this.newTask.trim(); if (!value) { return; } this.newTask = ''; this.tasks.push({ content: value, list: this.list, completed: false, level: this.tasks[this.tasks.length-1].level }); } }
});
Developer | Kasper Mikiewicz |
Username | Idered |
Uploaded | November 21, 2022 |
Rating | 3 |
Size | 5,092 Kb |
Views | 14,168 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Color accordion | 1,925 Kb |
Simple loader | 2,645 Kb |
Love button | 3,597 Kb |
Pagination | 3,868 Kb |
Flat radio buttons | 2,759 Kb |
Degree Picker | 4,307 Kb |
Pure CSS read more toggle | 2,344 Kb |
Notifications | 3,250 Kb |
Responsive color picker | 2,932 Kb |
Pure CSS3 Tags | 4,052 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Bootstrap 4 Gridsystem Demo | Rivella50 | 1,535 Kb |
A Pen by aleen42 | Aleen42 | 11,473 Kb |
CSS Clip and Shape Module clearly | Pestov | 2,640 Kb |
Break Out | AzazelN28 | 12,431 Kb |
C.Rowe Button | Brownerd | 2,473 Kb |
Pomodoro Clock | Osycon | 3,705 Kb |
Tic Tac Toe | Volv | 4,862 Kb |
Long Shadow Button | Uixcrazy | 3,550 Kb |
Preloader | Rikki_Sixx | 2,815 Kb |
Basic 3D Fullscreen Transition | Apetrov | 3,270 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!