update data on change
This commit is contained in:
@@ -82,22 +82,13 @@ let app = {
|
||||
},
|
||||
deleteRow(i) {
|
||||
this.available.pop(i);
|
||||
this.updateData();
|
||||
this.reset();
|
||||
},
|
||||
addRow() {
|
||||
if (this.newRow[0] && this.newRow[1]) {
|
||||
this.available.push(utils.cloneObject(this.newRow));
|
||||
this.newRow = ["", ""];
|
||||
}
|
||||
this.updateData();
|
||||
},
|
||||
updateData() {
|
||||
const data = utils.serialize(this.available);
|
||||
const url = new URL(window.location);
|
||||
if (url.searchParams.get("d") !== data) {
|
||||
url.searchParams.set("d", data);
|
||||
window.history.pushState({}, "", url);
|
||||
}
|
||||
this.reset();
|
||||
},
|
||||
reset() {
|
||||
@@ -128,6 +119,14 @@ let app = {
|
||||
this.reset();
|
||||
}
|
||||
},
|
||||
updated() {
|
||||
const data = utils.serialize(this.available);
|
||||
const url = new URL(window.location);
|
||||
if (url.searchParams.get("d") !== data) {
|
||||
url.searchParams.set("d", data);
|
||||
window.history.pushState({}, "", url);
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
setTimeout(this.showApp);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user