Skip to content

Commit cc23603

Browse files
authored
Update index.html
1 parent b08ed4f commit cc23603

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

dio-v1.2.1/index.html

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,26 @@
5353
return data;
5454
}
5555
updateData(mod = 10) {
56-
for (let i=0;i<this.data.length;i+=10) {
57-
this.data[i] = Object.assign({}, this.data[i], {label: this.data[i].label + ' !!!'});
58-
}
56+
const data = this.data;
57+
58+
for (let i = 0; i < data.length; i += 10) {
59+
const r = data[i];
60+
r.label += " !!!";
61+
}
5962
}
6063
delete(id) {
61-
const idx = this.data.findIndex(d => d.id==id);
62-
this.data.splice(idx, 1);
64+
var idx = id - 1;
65+
var data = this.data;
66+
67+
if (idx === 0) {
68+
data.shift();
69+
}
70+
else if (id === data.length) {
71+
data.pop();
72+
}
73+
else {
74+
data.splice(idx, 1);
75+
}
6376
}
6477
run() {
6578
this.data = this.buildData();

0 commit comments

Comments
 (0)