fix: 支持低代码组件样式

This commit is contained in:
mario.gk 2020-08-14 15:23:55 +08:00
parent 5050af7cb6
commit 6e64be13fa

View File

@ -219,6 +219,15 @@ export class SimulatorRenderer implements BuiltinSimulatorRenderer {
_schema.methods = {};
_schema.lifeCycles = {};
if (schema.componentName === 'Component' && (schema as ComponentSchema).css) {
const doc = window.document;
const s = doc.createElement('style');
s.setAttribute('type', 'text/css');
s.setAttribute('id', `Component-${schema.id || ''}`);
s.appendChild(doc.createTextNode((schema as ComponentSchema).css || ''));
doc.getElementsByTagName('head')[0].appendChild(s);
}
const node = host.document.createNode(_schema);
_schema = node.export(TransformStage.Render);