You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

34 lines
738 B

const $filterNullChildren = children => {
children = deepFlatten(children);
return children.filter(child => child != null);
};
const deepFlatten = arr => {
let flatten = arr => [].concat(...arr);
return flatten(arr.map(x => Array.isArray(x) ? deepFlatten(x) : x));
};
export default ((data, opt) => {
const {
View,
Text,
Image
} = opt;
Object.assign(data, {});
return new View({
style: {},
attr: {
"needRoot": true
},
children: $filterNullChildren([new Canvas({
style: {},
attr: {
"id": "canvas",
"type": "2d",
"style": "width: " + data.width + "px; height: " + data.height + "px;"
},
children: $filterNullChildren([])
})])
});
});