Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of TodoList in Vue

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you the example analysis of TodoList in Vue, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Import Top from'. / components/Top.vue' import Bottom from'. / components/Bottom.vue' import List from'. / components/List.vue' export default {name: 'App', components: {Top, List, Bottom}, data () {return {todos: [{id:' 001 dinner, title: 'dinner' Done: true}, {id: '002', title: 'sleep', done: false}, {id: '003', title: 'hit Doudou', done: false},]}} Methods: {/ / add a todo received (todoObj) {this.todos.unshift (todoObj) }, / / uncheck todo checkTodo (id) {this.todos.forEach ((todo) = > {/ / function body if (todo.id = id) todo.done =! todo.done })}, / / delete deleteTodo (id) {this.todos = this.todos.filter (todo = > todo.id! = = id)}, / / deselect all checkAllTodo (done) {this.todos.forEach ((todo) = > {todo.done = done})})} / / clear all completed data clearAllTodo () {this.todos = this.todos.filter ((todo) = > {return! todo.done})} / * base*/ body {background: # fff } .btn {display: inline-block; padding: 4px 12px; margin-bottom: 0; font-size: 14px; line-height: 20px; text-align: center; vertical-align: middle; cursor: pointer; box-shadow: inset 0 1px 0 rgba (255,255,255,0.2), 0 1px 2px rgba (0,0,0,0.05); border-radius: 4px;} .btn-danger {color: # fff Background-color: # da4f49; border: 1px solid # bd362f;}. Btn-danger:hover {color: # fff; background-color: # bd362f;} .btn: focus {outline: none;}. Todo-container {width: 600px; margin: 0 auto;}. Todo-container. Todo-wrap {padding: 10px; border: 1px solid # ddd; border-radius: 5px } these are all the contents of the article "sample Analysis of TodoList in Vue". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report