Skip to Content
微前端设计与实现
book

微前端设计与实现

by Luca Mezzalira
August 2022
Beginner to intermediate
270 pages
7h 38m
Chinese
Posts & Telecom Press
Content preview from 微前端设计与实现
探索微前端架构
39
App shell
由一个简单的
HTML
页面和一个包含其逻辑的
JavaScript
文件组成。为了提升用
户第一次加载时的体验,
App shell
也有可能包含一些
CSS
样式
,比如显示一个像
spinner
这样的加载动画。每一个微前端入口都是一个包含单个页面的逻辑和样式的
HTML
面,
或者是一个包含几个路由的小型单页应用。这些路由完整覆盖了某个业务模块,允许用户
在不需要加载新的微前端的情况下就可以访问整个应用的子域。一个
JavaScript
文件也可
以作为微前端的入口被加载,但在这种情况下,用户等待页面加载的体验并不友好,因为
必须等到
JavaScript
文件被解析后,它才能将新的元素添加到
DOM
中。
当我们想打造一致的用户体验,同时想让团队享有完整的控制权时,纵向拆分的方法很好
用。当多个视图没有重复的业务子域,且应用的每一部分都可由单一的应用来表示时,你
应该对应用采用纵向拆分。
当我们清楚地了解用户如何与应用互动时,识别微前端就变得容易了。如果使用
Google
Analytics
这样的分析工具
,你就可以获得这些信息。如果没有这些信息,你需要在确定如
何构建架构、业务领域和组织之前获取这些信息。在这种架构下,微前端的可复用性并不
高,所以一个纵向拆分的微前端不太可能在同一个应用中被多次复用。
然而,在每一个微前端中,我们可以复用一些组件(想一想设计系统),通过模块化有助
于避免过多地重复代码。不过,更有可能的是,微前端会在同一公司维护的不同应用中被
重复使用。想象一下,在一个多租户的环境中 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Python语言及其应用(第2版)

Python语言及其应用(第2版)

Bill Lubanovic

Publisher Resources

ISBN: 9787115595089