最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

在vue中實(shí)現(xiàn)iframe嵌套Html頁面及注意事項(xiàng)說明

 更新時間:2023年10月11日 08:48:33   作者:琉-璃  
這篇文章主要介紹了在vue中實(shí)現(xiàn)iframe嵌套Html頁面及注意事項(xiàng)說明,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教

vue實(shí)現(xiàn)iframe嵌套Html頁面及注意事項(xiàng)

如圖:

跳轉(zhuǎn)的個人中心為HTML頁面,引用的是iframe嵌套

一、要嵌套的地方加上以下代碼

如下:

<template>
  <div class="hello" >
    <iframe src="/static/aa.html" id="qt" scrolling="no" frameborder="0" style="position:absolute;top:64px;left: 0px;right:0px;bottom:100px;"></iframe>
  </div>
</template>
<script>
export default {
  name: 'adminIndex',
  data () {
    return {
    }
  },
  mounted () {
    /**
            * iframe-寬高自適應(yīng)顯示
            */
    function changeqtIframe () {
      const qt = document.getElementById('qt')
      const deviceWidth = document.body.clientWidth
      const deviceHeight = document.body.clientHeight
      qt.style.width = Number(deviceWidth) + 'px' // 數(shù)字是頁面布局寬度差值
      qt.style.height = Number(deviceHeight) + 'px' // 數(shù)字是頁面布局高度差
    }
    changeqtIframe()
    window.onresize = function () {
      changeqtIframe()
    }
  }
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>

二、在運(yùn)行項(xiàng)目npm run dev時

iframe中的src為你本項(xiàng)目的中的文件,所以要把HTML頁面放在項(xiàng)目里面,如果是外部文件的話直接替換成https://www.....就行,我的是直接在項(xiàng)目根目錄下新建一個static文件夾,這樣正常跳轉(zhuǎn)既可實(shí)現(xiàn)效果。

如下:

 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>zwh</title> 
<head>
  <meta charset="utf-8">
  <title>iframe Window</title>
  <style>
    body {
      background-color: white;
      color: rgb(71, 34, 34);
    }
  </style>
</head>
<body>
<h1>Html頁面展示</h1>
<button>向VUE發(fā)送信息</button>
<script> 
</script>
</body>
</html> 

三、需注意的是

當(dāng)進(jìn)行靜態(tài)文件打包npm run build時,iframe中的路徑為你本地現(xiàn)在這個盤下的文件,

例如:

我這個案例,打包完src就等于D:/static/aa.html,在本地D盤根目錄下必須有一個這一個文件,部署到網(wǎng)上也是同理

總結(jié)

以上為個人經(jīng)驗(yàn),希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

高碑店市| 中牟县| 南召县| 平度市| 阆中市| 普兰店市| 黎城县| 南华县| 黔南| 舟山市| 夹江县| 忻城县| 东平县| 洛南县| 玛曲县| 聂拉木县| 迁西县| 渭源县| 土默特左旗| 阿瓦提县| 延吉市| 如东县| 长治市| 秦安县| 榆社县| 个旧市| 长兴县| 科技| 兴国县| 千阳县| 广饶县| 墨竹工卡县| 台中市| 绥中县| 石首市| 增城市| 罗江县| 金川县| 临洮县| 静乐县| 霍山县|