@@ -81,16 +81,18 @@ export default class IframeSandbox {
81
81
// TODO: 放到 super中定义,super(appName, url),with沙箱也需要简化
82
82
public appName : string
83
83
public url : string
84
+ public options ?: Record < string , any >
84
85
// reset mount, unmount when stop in default mode
85
86
public clearHijackUmdHooks ! : ( ) => void
86
87
87
- constructor ( appName : string , url : string ) {
88
+ constructor ( appName : string , url : string , options : Record < string , any > ) {
88
89
this . appName = appName
89
90
this . url = url
91
+ this . options = options
90
92
const rawLocation = globalEnv . rawWindow . location
91
93
const browserHost = rawLocation . protocol + '//' + rawLocation . host
92
94
93
- this . deleteIframeElement = this . createIframeElement ( appName , browserHost + rawLocation . pathname )
95
+ this . deleteIframeElement = this . createIframeElement ( appName , browserHost + rawLocation . pathname , options )
94
96
this . microAppWindow = this . iframe ! . contentWindow
95
97
96
98
this . patchIframe ( this . microAppWindow , ( resolve : CallableFunction ) => {
@@ -126,10 +128,12 @@ export default class IframeSandbox {
126
128
createIframeElement (
127
129
appName : string ,
128
130
browserPath : string ,
131
+ options ?: Record < string , any >
129
132
) : ( ) => void {
130
133
this . iframe = pureCreateElement ( 'iframe' )
131
134
132
135
const iframeAttrs : Record < string , string > = {
136
+ ...options ?. attrs ,
133
137
id : appName ,
134
138
src : microApp . options . iframeSrc || browserPath ,
135
139
style : 'display: none' ,
0 commit comments