Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug提交:带数字顺序的数组排序无法改变 #5

Open
570295535 opened this issue May 31, 2022 · 1 comment
Open

bug提交:带数字顺序的数组排序无法改变 #5

570295535 opened this issue May 31, 2022 · 1 comment

Comments

@570295535
Copy link

问题例子:
var data = '{"0": "零零零","1": "一一一","2": "二二二","3": "三三三"}';
var data = JSON.parse(data);
yuxStorage.setItem('A', data).then(res => {
console.log('设置成功');
});

打乱顺序后:
var data = '{"3": "三三三","1": "一一一","2": "二二二","0": "零零零"}';
var data = JSON.parse(data);
yuxStorage.setItem('A', data).then(res => {
console.log('设置成功');
});

返回结果始终是第一次的:{"0": "零零零","1": "一一一","2": "二二二","3": "三三三"},

顺序怎么改它都不变,求修复!

@XboxYan
Copy link
Contributor

XboxYan commented Jun 16, 2022

@570295535 像这种对象本身就是无序的吧,为啥不用数组呢。而且在这一步JSON.parse(data)的时候就已经是相同的了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants