From d3a6bf1e0970c6eb95dbc33c6149affbacd3bbb2 Mon Sep 17 00:00:00 2001 From: smlsunxie Date: Thu, 5 Jul 2018 16:39:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AA=BF=E6=95=B4=E5=89=8D=E7=AB=AF=E9=87=9D?= =?UTF-8?q?=E5=B0=8D=20completed=20=E7=9A=84=E8=AE=8A=E5=8B=95=EF=BC=8C?= =?UTF-8?q?=E5=91=BC=E5=8F=AB=E5=AE=8C=E6=88=90=E7=9A=84=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ToDo.vue | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/ToDo.vue b/src/components/ToDo.vue index e6389a1..737a200 100644 --- a/src/components/ToDo.vue +++ b/src/components/ToDo.vue @@ -1,7 +1,7 @@ @@ -17,6 +17,20 @@ export default { type: Number, required: true } + }, + methods: { + async updateTodo(e) { + let id = this.todo.id; + let completed = e.target.checked; + let data = { + completed + } + let response = await fetch(`http://localhost:3000/api/task/${id}`, { + method: 'put', + headers: {"Content-Type": "application/json"}, + body: JSON.stringify(data) + }); + } } }