Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 10 additions & 16 deletions src/components/FormSelectList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
* @param {*|*[]} list, array of objects
*/
transformOptions(list) {
const suffix = this.attributeParent(this.options.value);
const suffix = this.options.key;
let resultList = [];

list.forEach(item => {
Expand All @@ -183,11 +183,14 @@
parsedOption[this.optionsKey] = itemValue;
parsedOption[this.optionsValue] = itemContent;
if (this.options.valueTypeReturned === 'object') {
resultList.push(eval( suffix.length > 0 ? 'item.' + suffix : 'item'));
}
else {
resultList.push(parsedOption);
parsedOption = suffix.length > 0 ? get(item, suffix) : item;
Object.defineProperty(parsedOption, this.optionsValue, {
get: function() {
return itemContent;
}
});
}
resultList.push(parsedOption);
});
return resultList
},
Expand All @@ -199,13 +202,6 @@

return removed ? removed : str;
},
attributeParent(str) {
let parts = str.replace(/{{/g,'')
.replace(/}}/g,'')
.split('.')
parts.pop();
return parts.join('.');
},
updateWatcherDependentFieldValue(newSelectOptions, oldSelectOptions) {
let dataName = this.options.dataName.split('.');
// Check to see if the watcher output variable has been loaded.
Expand Down Expand Up @@ -308,11 +304,9 @@
optionsValue() {
if (this.options.dataSource && this.options.dataSource === 'provideData') {
return 'content';
} else {
return '__content__';
}

const fieldName = this.options.value || 'content';

return this.stripMustache(fieldName);
},
classList() {
return {
Expand Down