Add: allow array in var select
This commit is contained in:
parent
cd00c20fa4
commit
a901ca29c1
|
@ -198,10 +198,17 @@ var usercss = (function () {
|
||||||
result.default = match[1];
|
result.default = match[1];
|
||||||
} else if (state.type === 'select' || (state.type === 'image' && state.key === 'var')) {
|
} else if (state.type === 'select' || (state.type === 'image' && state.key === 'var')) {
|
||||||
parseJSON(state);
|
parseJSON(state);
|
||||||
result.options = Object.keys(state.value).map(k => ({
|
if (Array.isArray(state.value)) {
|
||||||
label: k,
|
result.options = state.value.map(text => ({
|
||||||
value: state.value[k]
|
label: text,
|
||||||
}));
|
value: text
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
result.options = Object.keys(state.value).map(k => ({
|
||||||
|
label: k,
|
||||||
|
value: state.value[k]
|
||||||
|
}));
|
||||||
|
}
|
||||||
result.default = result.options[0].value;
|
result.default = result.options[0].value;
|
||||||
} else if (state.type === 'dropdown' || state.type === 'image') {
|
} else if (state.type === 'dropdown' || state.type === 'image') {
|
||||||
if (state.text[state.re.lastIndex] !== '{') {
|
if (state.text[state.re.lastIndex] !== '{') {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user