IframePageView.vue 1.45 KB
<template>

    <iframe  :id="id" :src="url" frameborder="0" width="100%" height="800px" scrolling="auto"></iframe>

</template>

<script>

  export default {
    name: "IframePageContent",
    data () {
      return {
        url: "",
        id:""
      }
    },
    created () {
      this.goUrl()
    },
    updated () {
      this.goUrl()
    },
    watch: {
      $route(to, from) {
        this.goUrl();
      }
    },
    methods: {
      goUrl () {
        let url = this.$route.meta.url
        this.id = this.$route.path
        //url = "http://www.baidu.com"
        if (url !== null && url !== undefined) {
          this.url = url;
          /*update_begin author:wuxianquan date:20190908 for:判断打开方式,新窗口打开时this.$route.meta.internalOrExternal==true */
          // if(this.$route.meta.internalOrExternal != undefined && this.$route.meta.internalOrExternal==true){
          //   // 关闭当前标签
          //   // this.closeCurrent();
          //   //外部url加入token
          //   let tokenStr = "${token}";
          //   if(url.indexOf(tokenStr)!=-1){
          //     let token = Vue.ls.get(ACCESS_TOKEN);
          //      this.url = url.replace(tokenStr,token);
          //   }
          //   window.open(this.url);
          // }
          /*update_end author:wuxianquan date:20190908 for:判断打开方式,新窗口打开时this.$route.meta.internalOrExternal==true */

        }
      }
    }
  }
</script>

<style>
</style>