mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-04 17:27:09 +00:00
24 lines
536 B
TypeScript
24 lines
536 B
TypeScript
function ucfirst(s: string) {
|
|
return s.charAt(0).toUpperCase() + s.substring(1);
|
|
}
|
|
function getDeviceView(view: any, device: string, mode: string) {
|
|
if (!view || typeof view === 'string') {
|
|
return view;
|
|
}
|
|
|
|
// compatible vision Mobile | Preview
|
|
device = ucfirst(device);
|
|
if (device === 'Mobile' && view.hasOwnProperty(device)) {
|
|
view = view[device];
|
|
}
|
|
mode = ucfirst(mode);
|
|
if (mode === 'Preview' && view.hasOwnProperty(mode)) {
|
|
view = view[mode];
|
|
}
|
|
return view;
|
|
}
|
|
|
|
export default {
|
|
getDeviceView,
|
|
};
|