|
1
2
|
<template>
|
|
3
|
<iframe :id="id" :src="url" frameborder="0" width="100%" height="800px" scrolling="auto"></iframe>
|
|
4
5
6
7
|
</template>
<script>
|
|
8
9
10
11
|
import Vue from 'vue'
import {ACCESS_TOKEN} from "@/store/mutation-types"
import PageLayout from '../page/PageLayout'
import RouteView from './RouteView'
|
|
12
|
|
|
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
export default {
name: "IframePageContent",
inject: ['closeCurrent'],
data() {
return {
url: "",
id: ""
}
},
created() {
this.goUrl()
},
updated() {
this.goUrl()
},
watch: {
$route(to, from) {
this.goUrl();
}
},
methods: {
goUrl() {
let url = this.$route.meta.url
let id = this.$route.path
this.id = id
//url = "http://www.baidu.com"
console.log("------url------" + url)
if (url !== null && url !== undefined) {
//-----------------------------------------------------------------------------------------
//url支持通过 ${token}方式传递当前登录TOKEN
let tokenStr = "${token}";
if (url.indexOf(tokenStr) != -1) {
let token = Vue.ls.get(ACCESS_TOKEN);
this.url = url.replace(tokenStr, token);
} else {
this.url = url
}
//-----------------------------------------------------------------------------------------
|
|
51
|
|
|
52
53
54
55
|
/*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();
window.open(this.url);
|
|
56
|
}
|
|
57
58
|
/*update_end author:wuxianquan date:20190908 for:判断打开方式,新窗口打开时this.$route.meta.internalOrExternal==true */
|
|
59
60
61
|
}
}
}
|
|
62
|
}
|
|
63
64
65
66
|
</script>
<style>
</style>
|