Skip to content

Commit

Permalink
feat:react15微前端改造
Browse files Browse the repository at this point in the history
  • Loading branch information
dL-hx committed Aug 28, 2022
1 parent 1f1dfe7 commit ffccd12
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 19 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
git tag -a v0.1.0 -m "release 0.1.0 version"
git push origin --tags


Expand Down
25 changes: 24 additions & 1 deletion react15/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,27 @@ const render = () => {
<BasicMap />
), document.getElementById('app-react'))
}
render()
render()

if(!window.__MICRO_WEB__){ // 如果不是微前端环境,执行render
render()
}

// 如果在微前端环境,暴露生命周期

// 开始加载结构 (加载前的处理, 如参数处理..)
export const bootstrap = ()=>{
console.log("开始加载");
}


//
export const mount = ()=>{
console.log("渲染成功");
render()
}

export const unmount = ()=>{
console.log("卸载");
// 卸载时候卸载react实例,卸载事件,清空当前根元素的内容
}
32 changes: 16 additions & 16 deletions react15/src/pages/information/components/list/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,112 +13,112 @@ class InformationList extends React.Component {
this.state = {
list: [
{
img: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1695163309,2577846378&fm=26&gp=0.jpg',
img: 'https://youjia-image.cdn.bcebos.com/modelImage/ad1c9ae9fd2d4afa9ab5164ed215dd70/1625553531324910972d.JPG@!thumbnail',
title: '爱在大草原 吉利豪越的设计师一定是个暖男',
number: '3026',
type: '导购',
status: true
},
{
img: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1695163309,2577846378&fm=26&gp=0.jpg',
img: 'https://youjia-image.cdn.bcebos.com/modelImage/ad1c9ae9fd2d4afa9ab5164ed215dd70/1625553531324910972d.JPG@!thumbnail',
title: '爱在大草原 吉利豪越的设计师一定是个暖男',
number: '3026',
type: '导购',
status: false
},
{
img: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1695163309,2577846378&fm=26&gp=0.jpg',
img: 'https://youjia-image.cdn.bcebos.com/modelImage/ad1c9ae9fd2d4afa9ab5164ed215dd70/1625553531324910972d.JPG@!thumbnail',
title: '爱在大草原 吉利豪越的设计师一定是个暖男',
number: '3026',
type: '导购',
status: false
},
{
img: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1695163309,2577846378&fm=26&gp=0.jpg',
img: 'https://youjia-image.cdn.bcebos.com/modelImage/ad1c9ae9fd2d4afa9ab5164ed215dd70/1625553531324910972d.JPG@!thumbnail',
title: '爱在大草原 吉利豪越的设计师一定是个暖男',
number: '3026',
type: '导购',
status: false
},
{
img: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1695163309,2577846378&fm=26&gp=0.jpg',
img: 'https://youjia-image.cdn.bcebos.com/modelImage/ad1c9ae9fd2d4afa9ab5164ed215dd70/1625553531324910972d.JPG@!thumbnail',
title: '爱在大草原 吉利豪越的设计师一定是个暖男',
number: '3026',
type: '导购',
status: false
},
{
img: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1695163309,2577846378&fm=26&gp=0.jpg',
img: 'https://youjia-image.cdn.bcebos.com/modelImage/ad1c9ae9fd2d4afa9ab5164ed215dd70/1625553531324910972d.JPG@!thumbnail',
title: '爱在大草原 吉利豪越的设计师一定是个暖男',
number: '3026',
type: '导购',
status: false
},
{
img: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1695163309,2577846378&fm=26&gp=0.jpg',
img: 'https://youjia-image.cdn.bcebos.com/modelImage/ad1c9ae9fd2d4afa9ab5164ed215dd70/1625553531324910972d.JPG@!thumbnail',
title: '爱在大草原 吉利豪越的设计师一定是个暖男',
number: '3026',
type: '导购',
status: false
},
{
img: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1695163309,2577846378&fm=26&gp=0.jpg',
img: 'https://youjia-image.cdn.bcebos.com/modelImage/ad1c9ae9fd2d4afa9ab5164ed215dd70/1625553531324910972d.JPG@!thumbnail',
title: '爱在大草原 吉利豪越的设计师一定是个暖男',
number: '3026',
type: '导购',
status: false
},
{
img: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1695163309,2577846378&fm=26&gp=0.jpg',
img: 'https://youjia-image.cdn.bcebos.com/modelImage/ad1c9ae9fd2d4afa9ab5164ed215dd70/1625553531324910972d.JPG@!thumbnail',
title: '爱在大草原 吉利豪越的设计师一定是个暖男',
number: '3026',
type: '导购',
status: false
},
{
img: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1695163309,2577846378&fm=26&gp=0.jpg',
img: 'https://youjia-image.cdn.bcebos.com/modelImage/ad1c9ae9fd2d4afa9ab5164ed215dd70/1625553531324910972d.JPG@!thumbnail',
title: '爱在大草原 吉利豪越的设计师一定是个暖男',
number: '3026',
type: '导购',
status: false
},
{
img: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1695163309,2577846378&fm=26&gp=0.jpg',
img: 'https://youjia-image.cdn.bcebos.com/modelImage/ad1c9ae9fd2d4afa9ab5164ed215dd70/1625553531324910972d.JPG@!thumbnail',
title: '爱在大草原 吉利豪越的设计师一定是个暖男',
number: '3026',
type: '导购',
status: false
},
{
img: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1695163309,2577846378&fm=26&gp=0.jpg',
img: 'https://youjia-image.cdn.bcebos.com/modelImage/ad1c9ae9fd2d4afa9ab5164ed215dd70/1625553531324910972d.JPG@!thumbnail',
title: '爱在大草原 吉利豪越的设计师一定是个暖男',
number: '3026',
type: '导购',
status: false
},
{
img: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1695163309,2577846378&fm=26&gp=0.jpg',
img: 'https://youjia-image.cdn.bcebos.com/modelImage/ad1c9ae9fd2d4afa9ab5164ed215dd70/1625553531324910972d.JPG@!thumbnail',
title: '爱在大草原 吉利豪越的设计师一定是个暖男',
number: '3026',
type: '导购',
status: false
},
{
img: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1695163309,2577846378&fm=26&gp=0.jpg',
img: 'https://youjia-image.cdn.bcebos.com/modelImage/ad1c9ae9fd2d4afa9ab5164ed215dd70/1625553531324910972d.JPG@!thumbnail',
title: '爱在大草原 吉利豪越的设计师一定是个暖男',
number: '3026',
type: '导购',
status: false
},
{
img: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1695163309,2577846378&fm=26&gp=0.jpg',
img: 'https://youjia-image.cdn.bcebos.com/modelImage/ad1c9ae9fd2d4afa9ab5164ed215dd70/1625553531324910972d.JPG@!thumbnail',
title: '爱在大草原 吉利豪越的设计师一定是个暖男',
number: '3026',
type: '导购',
status: false
},
{
img: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1695163309,2577846378&fm=26&gp=0.jpg',
img: 'https://youjia-image.cdn.bcebos.com/modelImage/ad1c9ae9fd2d4afa9ab5164ed215dd70/1625553531324910972d.JPG@!thumbnail',
title: '爱在大草原 吉利豪越的设计师一定是个暖男',
number: '3026',
type: '导购',
Expand Down
2 changes: 1 addition & 1 deletion react15/src/pages/information/components/news/index 2.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class InformationNews extends React.Component {

{/* 广告位 */}
<div className="information-news-detail">
<img src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1695163309,2577846378&fm=26&gp=0.jpg" alt=""/>
<img src="https://youjia-image.cdn.bcebos.com/modelImage/ad1c9ae9fd2d4afa9ab5164ed215dd70/1625553531324910972d.JPG@!thumbnail" alt=""/>
</div>
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion react15/src/pages/information/components/news/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class InformationNews extends React.Component {

{/* 广告位 */}
<div className="information-news-detail">
<img src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1695163309,2577846378&fm=26&gp=0.jpg" alt=""/>
<img src="https://www.volvocars.com.cn/images/v/cn/-/media/project/contentplatform/data/media/my23/featured-models/s90_recharge_lwb_promoted_vehicle_desktop_1920x1440.jpg?iar=0&w=1080" alt=""/>
</div>
</div>
)
Expand Down

0 comments on commit ffccd12

Please sign in to comment.