使用tailor 轻松方便的集成web 框架react&&vue

tailor 是一款很方便的layout 服务,类似facebook 的bigpipe,我们可以使用此工具
方便的集成各类web 框架,实现micro-fronteds 开发

参考demo

https://github.com/rongfengliang/tail-react-vue

说明

代码很简单,是从github 上集成合并的
https://github.com/tsnolan23/tailor-react-spa && https://github.com/shershen08/tailor-vue-demo
目的很简单,就是一个简单的集成测试

运行说明

  • 初始化依赖
    因为使用了lerna 
 yarn && yarn install-fragment-dependencies
 
  • 启动依赖服务  
yarn start-fragments
 
  • 启动tailor 服务
yarn start
 

修改说明

主要是templates 的index.html

 
<!doctype html>
<html>
<head>
  <title>Tailor Example Application</title>
  <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0">
  <style>
    body {
      background: #ECEFF4;
    }
  </style>
  <script>
    (function(d) {
      require(d);
      var arr = [ 'react', 'react-dom', 'prop-types', 'classnames', 'proppy', 'proppy-react'];
      while (i = arr.pop())(function(dep) {
        define(dep, d, function(b) {
          return b[dep];
        })
      })(i);
    }(['http://localhost:6006/public/bundle.js']));
  </script>
</head>
<body>
  <div id="header"></div>
  <div id="dashboard"></div>
  <div id="contacts"></div>
  <div id="chat"></div>
+ <fragment src="http://localhost:8090"></fragment>
  <fragment src="http://localhost:8081"></fragment>
  <fragment src="http://localhost:5000"></fragment>
  <fragment src="http://localhost:3000"></fragment>
</body>
</html>
 

测试效果

  • UI 效果
  • 资源加载

说明

tailor 的fragment 开发模型,可以加速我们micro-frontends 的开发,功能还是很强大的,v4 版本也即将发布了,新的功能还是很期待的

参考资料

https://github.com/zalando/tailor
https://github.com/tsnolan23/tailor-react-spa
https://github.com/shershen08/tailor-vue-demo
https://github.com/rongfengliang/tail-react-vue

posted on   荣锋亮  阅读(889)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2017-12-11 apache phoenix 安装试用

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示