保存进度!

This commit is contained in:
Kane 2022-10-22 01:35:43 +08:00
parent c768a04b90
commit 2a160aaabc
2 changed files with 239 additions and 105 deletions

View File

@ -2,7 +2,7 @@
* @Author: Kane * @Author: Kane
* @Date: 2022-10-21 16:39:27 * @Date: 2022-10-21 16:39:27
* @LastEditors: Kane * @LastEditors: Kane
* @LastEditTime: 2022-10-21 18:56:19 * @LastEditTime: 2022-10-22 01:23:49
* @FilePath: \car_dealer\css\todo-list\to-list.css * @FilePath: \car_dealer\css\todo-list\to-list.css
* @Description: 用于待办事项页面的css * @Description: 用于待办事项页面的css
* *
@ -11,12 +11,16 @@
html { html {
--border-color: #cfcfcf; --border-color: #cfcfcf;
--hr-color: #efefef;
--backupground-color: #f7f7f7; --backupground-color: #f7f7f7;
--btn-color-blue: #307dbe; --btn-color-blue: #307dbe;
--btn-color-yellow: #f7b24d; --btn-color-yellow: #f7b24d;
--btn-color-green: #5bad60; --btn-color-green: #5bad60;
--btn-color-red: #e56651; --btn-color-red: #e56651;
--btn-font-color: #fff; --btn-font-color: #fff;
--light-shadow: #cfcfcf;
--dark-shadow: #afafaf;
} }
.border { .border {
@ -24,6 +28,12 @@
border-radius: 5px; border-radius: 5px;
width: 30rem; width: 30rem;
padding: 1em; padding: 1em;
box-shadow: 0px 0px 10px var(--light-shadow);
}
.border:hover {
box-shadow: 0px 0px 10px var(--dark-shadow);
transition: box-shadow 1;
} }
.border > .add_todo { .border > .add_todo {
@ -33,13 +43,11 @@
} }
.border > .add_todo > button { .border > .add_todo > button {
margin-left: 5px; margin-left: 5px;
flex-basis: 4rem; flex-basis: 4rem;
flex-grow: 0; flex-grow: 0;
font-size: 1rem; font-size: 1rem;
height: 2.3rem; height: 2.3rem;
} }
.border > .add_todo > input { .border > .add_todo > input {
@ -54,13 +62,32 @@
hr { hr {
border: none; border: none;
margin-top: 15px; margin-top: 1rem;
background-color: var(--border-color); background-color: var(--border-color);
height: 2px; height: 2px;
} }
.border > .todo_list { .border > .todo_list {
margin-top: 15px; margin-top: 1rem;
height: 12.2rem;
overflow-y: auto;
}
.todo_list::-webkit-scrollbar {
width: 10px;
height: 100px;
}
.todo_list::-webkit-scrollbar-thumb {
border-radius: 10px;
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
background: #535353;
}
.todo_list::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 5px var(--backupground-color);
border-radius: 10px;
background: #ededed;
} }
.border > .todo_list > * + * { .border > .todo_list > * + * {
@ -73,7 +100,7 @@
justify-content: center; justify-content: center;
} }
.border > .todo_list div > input[type=checkbox] { .border > .todo_list div > input[type="checkbox"] {
flex-grow: 0; flex-grow: 0;
} }
@ -106,3 +133,12 @@
.border > .todo_list input { .border > .todo_list input {
outline: 1px solid var(--border-color); outline: 1px solid var(--border-color);
} }
.border > .tools {
margin-top: 1rem;
}
.border > .tools > p {
text-align: right;
margin: 0px 1rem;
}

View File

@ -2,7 +2,7 @@
* @Author: Kane * @Author: Kane
* @Date: 2022-10-21 16:36:51 * @Date: 2022-10-21 16:36:51
* @LastEditors: Kane * @LastEditors: Kane
* @LastEditTime: 2022-10-21 19:02:01 * @LastEditTime: 2022-10-22 00:45:07
* @FilePath: \car_dealer\vue\todo-lilst.html * @FilePath: \car_dealer\vue\todo-lilst.html
* @Description: * @Description:
* *
@ -10,6 +10,7 @@
--> -->
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
@ -21,6 +22,7 @@
<link rel="stylesheet" href="../css/todo-list/to-list.css" /> <link rel="stylesheet" href="../css/todo-list/to-list.css" />
<script src="../js/vue/vue.global.js"></script> <script src="../js/vue/vue.global.js"></script>
</head> </head>
<body> <body>
<div id="app"> <div id="app">
<div class="content"> <div class="content">
@ -30,26 +32,22 @@
<input type="text" placeholder="请输入待办事项" /> <input type="text" placeholder="请输入待办事项" />
<button type="button">添加</button> <button type="button">添加</button>
</div> </div>
<hr /> <hr>
<div class="todo_list"> <div class="todo_list">
<div v-for="(item,index) in todo_list" :key="index"> <div v-for="(item,index) in todo_list" :key="index">
<input <input type="checkbox" v-model="todo_list[index].selected" />
type="checkbox"
v-model="todo_list[index].selected"
/>
<span v-show="!item.edit">{{item.todo_text}}</span> <span v-show="!item.edit">{{item.todo_text}}</span>
<input <input type="text" v-show="item.edit" v-model="item.todo_text" />
type="text" <button type="button" v-on:click="editTodo(index,event)">
v-show="item.edit"
v-model="item.todo_text"
/>
<button type="button" v-on:click="editTodo(index)">
修改 修改
</button> </button>
<button type="button">删除</button> <button type="button" @click="removeTodo(index)">删除</button>
</div> </div>
</div> </div>
<div class="tools"></div> <hr>
<div class="tools">
<p class="summary">总计:{{todo_list.length}}</p>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -59,21 +57,120 @@
data() { data() {
return { return {
title: "待办任务", title: "待办任务",
todo_list: [ todo_list: [{
{ selected: false, todo_text: "回家", edit: false }, selected: false,
{ selected: true, todo_text: "吃饭", edit: false }, todo_text: "回家",
{ selected: false, todo_text: "洗澡", edit: false }, edit: false
{ selected: false, todo_text: "玩游戏", edit: false }, },
{
selected: true,
todo_text: "吃饭",
edit: false
},
{
selected: false,
todo_text: "洗澡",
edit: false
},
{
selected: false,
todo_text: "玩游戏",
edit: false
},
{
selected: false,
todo_text: "回家",
edit: false
},
{
selected: true,
todo_text: "吃饭",
edit: false
},
{
selected: false,
todo_text: "洗澡",
edit: false
},
{
selected: false,
todo_text: "玩游戏",
edit: false
},
{
selected: false,
todo_text: "回家",
edit: false
},
{
selected: true,
todo_text: "吃饭",
edit: false
},
{
selected: false,
todo_text: "洗澡",
edit: false
},
{
selected: false,
todo_text: "玩游戏",
edit: false
},
{
selected: false,
todo_text: "回家",
edit: false
},
{
selected: true,
todo_text: "吃饭",
edit: false
},
{
selected: false,
todo_text: "洗澡",
edit: false
},
{
selected: false,
todo_text: "玩游戏",
edit: false
},
{
selected: false,
todo_text: "回家",
edit: false
},
{
selected: true,
todo_text: "吃饭",
edit: false
},
{
selected: false,
todo_text: "洗澡",
edit: false
},
{
selected: false,
todo_text: "玩游戏",
edit: false
},
], ],
}; };
}, },
methods: { methods: {
addTodo() {}, addTodo() {},
editTodo(index) { editTodo(index, event) {
console.log(index); console.log(index);
console.log(event);
this.todo_list[index].edit = !this.todo_list[index].edit; this.todo_list[index].edit = !this.todo_list[index].edit;
}, },
removeTodo(index) {
this.todo_list.splice(index, 1);
}
}, },
computed: { computed: {
buttonText(edit) { buttonText(edit) {
@ -85,4 +182,5 @@
const vm = Vue.createApp(app); const vm = Vue.createApp(app);
vm.mount("#app"); vm.mount("#app");
</script> </script>
</html> </html>