let arrStr = '{"2元": "200", "3元": "300"}';
let arr = [];
for(let i in JSON.parse(arrStr)){
arr.push({ [i] :JSON.parse(arrStr)[i]})
}
},
var optionlist = []
var obj = {"1元":"100";"2元":"200";"4元":"400"}
for (let i in obj) {
var k = {};
k[i] = valueData[i];
optionlist.push(k);
}
console.log(optionlist);
__data__.valueOptions = optionlist;
var swapItems = function (arr, index1, index2) {
arr[index1] = arr.splice(index2, 1, arr[index1])[0]
return arr
}
var arr = [1, 2, 3];
var newArr = [];
function upData(arr, index) {
if (this.arr.length > 1 && index !== 0) {
newArr = swapItems(arr, index, index - 1)
};
}
function downData(arr, index) {
if (this.arr.length > 1 && index !== (this.arr.length - 1)) {
newArr = swapItems(this.arr, index, index + 1)
}
}
alert(upData(arr, 1));
笔记
|