mirror of
https://github.com/directus/directus.git
synced 2026-01-30 10:07:56 -05:00
add default render tmpl & scope to json display (#10124)
This commit is contained in:
@@ -46,15 +46,23 @@ export default defineComponent({
|
||||
|
||||
try {
|
||||
if (Array.isArray(props.value)) {
|
||||
return props.value.map((item: any) => render(props.format || '', item));
|
||||
return props.value.map((item: any) => renderValue(item));
|
||||
} else {
|
||||
return [render(props.format || '', props.value)];
|
||||
return [renderValue(props.value)];
|
||||
}
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
function renderValue(input: Record<string, any> | Record<string, any>[]) {
|
||||
if (props.format) {
|
||||
return render(props.format, input);
|
||||
} else {
|
||||
return render('{{ value }}', { value: input });
|
||||
}
|
||||
}
|
||||
|
||||
return { displayValue, t };
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user