diff --git a/2020/yhr/Todolist/css/main.css b/2020/yhr/Todolist/css/main.css
index eb0ba2f..7ae9f21 100644
--- a/2020/yhr/Todolist/css/main.css
+++ b/2020/yhr/Todolist/css/main.css
@@ -66,4 +66,5 @@ button {
color: white;
font-size: large;
background-color: rgb(45, 68, 82);
+ border: none;
}
\ No newline at end of file
diff --git a/2020/yhr/Todolist/index.html b/2020/yhr/Todolist/index.html
index d326a7b..b00fff4 100644
--- a/2020/yhr/Todolist/index.html
+++ b/2020/yhr/Todolist/index.html
@@ -24,13 +24,13 @@
· Todolist ·
{{ todo.name }} |
{{ todo.ddl }} |
- |
+ |
|
-
+
|
- |
+ |
|
diff --git a/2020/yhr/Todolist/js/main.js b/2020/yhr/Todolist/js/main.js
index e5eb5e6..fcb29f7 100644
--- a/2020/yhr/Todolist/js/main.js
+++ b/2020/yhr/Todolist/js/main.js
@@ -1,3 +1,4 @@
+// @ts-ignore
var app = new Vue({
el: '#app',
data: {
@@ -5,23 +6,32 @@ var app = new Vue({
ntodo: {
name: "",
ddl: "",
- finished: "Unfinished"
+ finished: "Unfinished",
+ style: "background-color: red"
}
},
methods: {
add: function() {
- this.todos.push(this.ntodo);
- this.ntodo = {
- name: "",
- ddl: "",
- finished: "Unfinished"
- };
+ // @ts-ignore
+ if (this.ntodo.name && this.ntodo.ddl) {
+ // @ts-ignore
+ this.todos.push(this.ntodo);
+ this.ntodo = {
+ name: "",
+ ddl: "",
+ finished: "Unfinished",
+ style: "background-color: red"
+ };
+ }
},
change: function(i) {
- if (this.todos[i].finished == "Finished")
+ if (this.todos[i].finished == "Finished") {
+ this.todos[i].style = "background-color: red";
this.todos[i].finished = "Unfinished";
- else
+ } else {
+ this.todos[i].style = "background-color: green";
this.todos[i].finished = "Finished";
+ }
},
deleted: function(i) {
this.todos.splice(i, 1);
@@ -36,6 +46,7 @@ var app = new Vue({
if (tmp != null) {
this.todos = tmp;
}
+ // @ts-ignore
add();
},
updated: function() {