Fix: setting bugs on Vue
This commit is contained in:
parent
3ee4cf27d5
commit
546b34275d
|
@ -23,13 +23,22 @@ var tlView = new Vue({
|
||||||
data: { config: tlConstruction },
|
data: { config: tlConstruction },
|
||||||
methods: {
|
methods: {
|
||||||
complete: function (i, val) {
|
complete: function (i, val) {
|
||||||
var ls = tlView.config[i].storage;
|
var ls = tlView.config[i];
|
||||||
if (!val) {
|
if (val) {
|
||||||
var id = tlView.config[i].id;
|
localStorage.setItem(ls.storage, val)
|
||||||
var val = $("#" + id).val()
|
} else {
|
||||||
|
if (!ls.data) {
|
||||||
|
ls = [ls]
|
||||||
|
} else {
|
||||||
|
ls = ls.data
|
||||||
}
|
}
|
||||||
|
for (var j = 0; j < ls.length; j++) {
|
||||||
M.toast({ html: 'Complete', displayLength: 3000 })
|
M.toast({ html: 'Complete', displayLength: 3000 })
|
||||||
localStorage.setItem(ls, val)
|
var id = ls[j].id;
|
||||||
|
var val = $("#" + id).val()
|
||||||
|
localStorage.setItem(ls[j].storage, val)
|
||||||
|
}
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,13 +48,22 @@ var postView = new Vue({
|
||||||
data: { config: postConstruction, kirishima: localStorage.getItem('kirishima') },
|
data: { config: postConstruction, kirishima: localStorage.getItem('kirishima') },
|
||||||
methods: {
|
methods: {
|
||||||
complete: function (i, val) {
|
complete: function (i, val) {
|
||||||
var ls = postView.config[i].storage;
|
var ls = postView.config[i];
|
||||||
M.toast({ html: 'Complete', displayLength: 3000 })
|
if (val) {
|
||||||
if (!val) {
|
localStorage.setItem(ls.storage, val)
|
||||||
var id = postView.config[i].id;
|
} else {
|
||||||
var val = $("#" + id).val()
|
if (!ls.data) {
|
||||||
|
ls = [ls]
|
||||||
|
} else {
|
||||||
|
ls = ls.data
|
||||||
|
}
|
||||||
|
for (var j = 0; j < ls.length; j++) {
|
||||||
|
M.toast({ html: 'Complete', displayLength: 3000 })
|
||||||
|
var id = ls[j].id;
|
||||||
|
var val = $("#" + id).val()
|
||||||
|
localStorage.setItem(ls[j].storage, val)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
localStorage.setItem(ls, val)
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,17 +113,30 @@ function load() {
|
||||||
}
|
}
|
||||||
var max = tlView.config.length;
|
var max = tlView.config.length;
|
||||||
for (var i = 0; i < max; i++) {
|
for (var i = 0; i < max; i++) {
|
||||||
var ls = tlView.config[i].storage;
|
if (ls) {
|
||||||
if (localStorage.getItem(ls)) {
|
if (localStorage.getItem(ls)) {
|
||||||
tlView.config[i].setValue = localStorage.getItem(ls)
|
tlView.config[i].setValue = localStorage.getItem(ls)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ls = tlView.config[i].data
|
||||||
|
for (var j = 0; j < ls.length; j++) {
|
||||||
|
tlView.config[i].data[j].setValue = localStorage.getItem(ls[j].storage)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var max = postView.config.length;
|
var max = postView.config.length;
|
||||||
for (var i = 0; i < max; i++) {
|
for (var i = 0; i < max; i++) {
|
||||||
var ls = postView.config[i].storage;
|
var ls = postView.config[i].storage;
|
||||||
|
if (ls) {
|
||||||
if (localStorage.getItem(ls)) {
|
if (localStorage.getItem(ls)) {
|
||||||
postView.config[i].setValue = localStorage.getItem(ls)
|
postView.config[i].setValue = localStorage.getItem(ls)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ls = postView.config[i].data
|
||||||
|
for (var j = 0; j < ls.length; j++) {
|
||||||
|
postView.config[i].data[j].setValue = localStorage.getItem(ls[j].storage)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (localStorage.getItem("imas")) {
|
if (localStorage.getItem("imas")) {
|
||||||
$(".imas").removeClass("hide");
|
$(".imas").removeClass("hide");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user