實現elementUI的tabs標籤頁切換時每個標籤頁下的iframe自動重載

  1. 首先給t每個tabs標籤頁下的iframe綁定ref,ref的值與el-tab-pane的name屬性的值一致
  2. 通過tab-click方法取到當前選中標籤頁的iframe,然後執行刷新
      <el-tabs v-model="activeName" @tab-click="handleClick" v-else>
        <el-tab-pane label="xxx" name="1">
          <iframe ref='1' width="100%" height="480px" :src=orderSurveyUrl></iframe ref='1'>
        </el-tab-pane>
        <el-tab-pane label="xxx" name="2">
          <iframe ref='2' width="100%" height="480px" :src=standardDeliverUrl></iframe>
        </el-tab-pane>
        <el-tab-pane label="xxx" name="3">
          <iframe ref='3' width="100%" height="480px" :src=hispb></iframe>
        </el-tab-pane>
        <el-tab-pane label="xxx" name="4">
          <iframe ref='4' width="100%" height="480px" :src=gatheringUrl></iframe>
        </el-tab-pane>
      </el-tabs>
      handleClick(tab, event) {
        console.log(tab.name);
        console.log(this.$refs[tab.name])
        this.$refs[tab.name].contentWindow.location.reload()
      },
發佈了41 篇原創文章 · 獲贊 10 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章