mirror of
https://github.com/tenrok/vue-json-viewer.git
synced 2026-06-20 20:00:37 +03:00
add an option to enable key sorting before display
This commit is contained in:
@@ -24,9 +24,11 @@ export default {
|
|||||||
ordered () {
|
ordered () {
|
||||||
const ordered = {};
|
const ordered = {};
|
||||||
if (this.sortKeys) {
|
if (this.sortKeys) {
|
||||||
Object.keys(this.jsonValue).sort().forEach(function(key) {
|
Object.keys(this.jsonValue).sort().forEach(key => {
|
||||||
ordered[key] = this.jsonValue[key];
|
ordered[key] = this.jsonValue[key];
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
ordered = this.jsonValue
|
||||||
}
|
}
|
||||||
return ordered;
|
return ordered;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user