alibaba / ice

🚀 ice.js: The Progressive App Framework Based On React(基于 React 的渐进式应用框架)
https://ice.work
MIT License
17.95k stars 2.1k forks source link

请问可以提供一个微模块的简易demo吗? #3958

Closed BigGaoYep closed 3 years ago

BigGaoYep commented 3 years ago

import React from 'react'; import ReactDOM from 'react-dom'; import App from "./model"; import { MicroModule, registerModules } from '@ice/stark-module';

registerModules([ { // render: () => , // name: 'module-demo1', name: 'module-demo1', url: 'http://localhost:3002/helloApp.js', mount: (ModuleComponent, mountNode) => { ReactDOM.render(, mountNode); }, }, ]);

ReactDOM.render(

, document.getElementById('root') ); 这个是微模块的单独项目 import { MicroModule, registerModules } from '@ice/stark-module'; import React from 'react' export default class App extends React.Component { componentDidMount() { registerModules([ { url: '/api2/helloApp.js', name: 'module-demo1', } ]); } render() { return } } 微模块想挂载在这个页面上 有没有大佬给提供个方案呀 我是做移动端的小白 谢谢各位大佬🙏
ClarkXia commented 3 years ago

@maoxiaoke

maoxiaoke commented 3 years ago

你可以使用

$ iceworks init component @icedesign/template-icestark-module

更多内容可参考官方文档 https://ice-lab.github.io/icestark/guide/micro-module