This commit is contained in:
2020-08-16 15:03:45 +08:00
parent e4bb86ead9
commit ff43780f12
3 changed files with 53 additions and 21 deletions

View File

@ -20,10 +20,24 @@ const app = new Vue({
this.$set(this.noteData[index], 'currentDelete', false)
},
confirmDelete(index){
console.log("删除", this.noteData[index])
// some ajax
mui.toast("删除")
window.location.reload()
$.ajax({
url: qlgUrl("app/note/delete"),
method: "POST",
data: {
id: this.noteData[index].id,
},
dataType: "json",
success: (res) => {
if(res.status != 1){
mui.alert(res.msg);
}
this.loadData();
},
error: (err) => {
mui.alert("请求失败");
this.loadData();
}
})
},
edit(index){
mui.openWindow({
@ -49,7 +63,7 @@ const app = new Vue({
url: qlgUrl("app/note/index"),
method: "GET",
dataType: 'json',
success: function(res){
success: (res) => {
if(res.status == 1){
this.noteData = res.data;
localStorage.setItem("LOCAL_NOTE", JSON.stringify(res.data));
@ -68,7 +82,13 @@ const app = new Vue({
var localData = localStorage.getItem("LOCAL_NOTE");
this.loadData();
if(localData){
this.noteData = JSON.parse(localData);
try{
JSON.parse(localData);
this.noteData = JSON.parse(localData);
} catch(e) {
console.log(e);
this.noteData = [];
}
}
},
})