update data on change
This commit is contained in:
@@ -82,22 +82,13 @@ let app = {
|
|||||||
},
|
},
|
||||||
deleteRow(i) {
|
deleteRow(i) {
|
||||||
this.available.pop(i);
|
this.available.pop(i);
|
||||||
this.updateData();
|
this.reset();
|
||||||
},
|
},
|
||||||
addRow() {
|
addRow() {
|
||||||
if (this.newRow[0] && this.newRow[1]) {
|
if (this.newRow[0] && this.newRow[1]) {
|
||||||
this.available.push(utils.cloneObject(this.newRow));
|
this.available.push(utils.cloneObject(this.newRow));
|
||||||
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();
|
this.reset();
|
||||||
},
|
},
|
||||||
reset() {
|
reset() {
|
||||||
@@ -128,6 +119,14 @@ let app = {
|
|||||||
this.reset();
|
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 () {
|
mounted: function () {
|
||||||
setTimeout(this.showApp);
|
setTimeout(this.showApp);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user