回覆列表
  • 1 # 使用者834195712159

    可以的,

    程式碼示例:

    <template>

    <div>

    <iframe

    style="border:none"

    :width="searchTableWidth"

    :height="searchTableHeight"

    v-bind:src="reportUrl"

    ></iframe>

    </div>

    </template>

    <script>

    import Vue from "vue"

    export default {

    methods: {

    widthHeight() {

    this.searchTableHeight = window.innerHeight -146;

    this.searchTableWidth = window.innerWidth - 280

    },

    },

    data() {

    return {

    reportUrl: "",

    searchTableHeight: 0,

    searchTableWidth: 0

    }

    },

    mounted() {

    window.onresize = () => {

    this.widthHeight(); // 自適應高寬度

    };

    this.$nextTick(function () {

    this.widthHeight();

    });

    },

    created() {

    // 從路由裡動態獲取 url地址 具體地址看libs下util.js裡的 backendMenuToRoute 方法

    this.reportUrl = this.$route.meta.pathUrl

    },

    watch: {

    "$route": function () {

    // 監聽路由變化

    this.reportUrl = this.$route.meta.pathUrl

    }

    }

    }

    </script>

  • 中秋節和大豐收的關聯?
  • 大棚養殖肉雞,利潤和成本多少?