Giter VIP home page Giter VIP logo

Comments (6)

kvchen95 avatar kvchen95 commented on July 24, 2024 4

既然弹出全局不需要直接使用 iframe 不就更好了吗

from wujie.

yiludege avatar yiludege commented on July 24, 2024 3

这是个好问题,无界最早的兼容模式就是直接丢一个iframe让子应用去运行,但是发现存在一些问题:

现在运行js的iframe沙箱是隐藏起来放在body下面,不随子应用切换而销毁(内存常驻),如果把dom也放到iframe里面,势必这个iframe需要挂载到具体页面上,一旦切换页面整个iframe就会销毁,所以子应用切换的体验(白屏时间)就会很差和直接使用iframe效果差不多,并且会丧失预执行和保活等能力

所以最后决定采用dom iframe + js iframe的方案,这样的好处就是除了dom的弹窗不能够弹到全局,其他所有的能力和非兼容模式保持一致

from wujie.

anuoua avatar anuoua commented on July 24, 2024 2

说一下我的看法,对于保活这个可能并不是硬需求,我个人现在并不希望常驻内存,而且弹出到全局这点我觉得很重要。
是否考虑可以让用户自己选择呢? @yiludege

from wujie.

yiludege avatar yiludege commented on July 24, 2024 1

如果不常驻内存,那么子应用切换必然是白屏严重,我当时是这么考虑这个问题的
1、现在大部分前端框架都开始不支持ie这样的浏览器,也就是降级的这个case是越来越少的
2、如果都放到一个iframe内的话,弹窗还是不能全局,感觉效果和直接放一个<iframe src= "子应用url”>差不多,那么在这个场景用户还不如直接放个iframe
3、 要支持弹窗全局势必要将子应用的dom直接渲染在主应用节点上,然后框架层面还需要添加scope来做隔离,这个和乾坤的处理一致,子应用mount到指定$el上,兼容模式和非兼容模式用户还需要再代码层面做不同的区分,和收益比起来成本很高
现在的兼容模式和非兼容模式用户不用做任何区分,除了弹窗不能全局,其他所有的保持一致

from wujie.

Hollelihanqi avatar Hollelihanqi commented on July 24, 2024

我看 demo 上 弹窗是可以全局的,为什么你们又说不能全局
image

from wujie.

yiludege avatar yiludege commented on July 24, 2024

@Hollelihanqi 这个指的是降级场景哈,可以将降级开关打开,之后弹窗就无法弹出来了

from wujie.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.