H5 嵌套iframe并设置全屏
上图上代码
< template> < view class = "mp-large-screen-box" > < view class = "mp-large-screen-count" > < view class = "mp-mini-btn-color mp-box-count" hover- class = "mp-mini-btn-hover" @click= "clickLeft" > < uni- icons type= "left" size= "18" color= "#ffffff" > < / uni- icons> < / view> < iframe class = "mp-iframe" : src= "ptzUrl" frameborder= "0" : style= "` width: ${ dataInfos. windowHeight} px;height: ${ dataInfos. windowWidth} px;position: absolute;top: -4px;left: 0;transform: rotate(90deg);transform-origin: 175px 50%;position: absolute;left: 0px;right:0; ` "> < / iframe> < / view> < / view>
< / template> export default { data ( ) { return { dataInfos: { } , } } , props: { ptzUrl: { type: String, default : ( ) => '' , } , } , mounted ( ) { let that = this uni. getSystemInfo ( { success : function ( e ) { console. log ( e, '传参设备' ) that. dataInfos = e} , } ) } , methods: { clickLeft ( ) { this . $emit ( 'callbackFun' ) } , } , }
< / script>
< style scoped lang= "scss" > . mp- large- screen- box { width: 100 % ; height: 100 % ; . uni- navbar__content { border- bottom: 0 ; } } . mp- large- screen- count { width: 100 % ; height: 100 % ; } . mp- iframme { width: 100 % ; height: 100 % ; } . mp- mini- btn- color { margin- top: 14 px; position: fixed; display: block; padding- left: 14 px; padding- right: 14 px; box- sizing: border- box; font- size: 18 px; text- align: center; text- decoration: none; border- radius: 5 px; overflow: hidden; cursor: pointer; line- height: 36 px; font- size: 14 px; background- color: var ( -- mp- primary) ; border- color: var ( -- mp- primary) ; color: #fff; bottom: 30 px; width: 36 px; height: 36 px; right: 20 px; display: flex; justify- content: center; align- items: center; } . mp- mini- btn- hover { animation: var ( -- mp- primary- light- 10 ) ; } . mp- box- count { transform: rotate ( 90 deg) ; position: absolute; right: 40 px; z- index: 10 ; top: 10 px}
< / style>
搞定!(日常记录)