don't be deterred of the long snippets, for some of you guys, i think, it is quietly easy.
hope the headline says the main message of my question. What I am trying to do is to structure a amount of key:value
in combination with objects and arrays pairs.
Information
Example
var items = {
basic: {
someKey: [
{
id: 'title',
title: 'Title',
type: 'text', ...
}, ...
], ...
}, ...
}
After defining those things (need them later for single operations) i try to get in a structure so i can make it a bit more easier for later use.
var sections = [
{
title: 'Basic',
rows: [{
columns: [
{ title: 'Default', items: items.basic.someKey }, ...
]
}]
}, ...
]
some kind of output would be like this:
<input type="<%= item.type %>" id="<%= item.id %>" value="<%= item.value %>" placeholder="<%= item.ph %>">
I think you might want to check out JSON . Plenty of libraries for parsing and generating it, and it's based on a subset of JavaScript so you shouldn't have to change your syntax too much if at all.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.