qiankun严格+沙箱模式下找不到子应用dom

2021-11-03  本文已影响0人  callPromise

vue版(2.6.12)
基座(主应用)中启动时

start({
  prefetch: false,
  sandbox: {
    strictStyleIsolation: true, // 开启严格的样式隔离模式
    experimentalStyleIsolation: true
  }
})

子应用render时

// 把$mount('#app')中的#app换成
document.querySelector('#root-view').firstElementChild.shadowRoot.querySelector('#app')

注意: @keyframes, @font-face, @import, @page 将不被支持 (i.e. 不会被改写)
参考官网API
https://qiankun.umijs.org/zh/api

上一篇 下一篇

猜你喜欢

热点阅读