可以的,
程式碼示例:
<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 () {
// 監聽路由變化
</script>
可以的,
程式碼示例:
<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>