1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 1× 36× 36× 36× 36× 36× 36× 36× 1× 36× | import { render, createElement, unmountComponentAtNode } from 'rax';
let id = 0;
export function renderSFCModule(Mod) {
Eif (Mod && Mod.__esModule === true) {
// 兼容 commonjs
Mod = Mod.default;
}
const container = document.createElement('div');
container.setAttribute('id', 'test-container-' + id++);
document.body.appendChild(container);
render(createElement(Mod, {}, []), container);
container.unmount = () => {
unmountComponentAtNode(container);
};
return container;
}
|