File tree Expand file tree Collapse file tree 3 files changed +72
-0
lines changed Expand file tree Collapse file tree 3 files changed +72
-0
lines changed Original file line number Diff line number Diff line change
1
+ <template >
2
+ <transition-group name =" fade-transform" mode =" out-in" >
3
+ <inner-link
4
+ v-for =" (item, index) in iframeViews"
5
+ :key =" item.path"
6
+ :iframeId =" 'iframe' + index"
7
+ v-show =" $route.path === item.path"
8
+ :src =" item.meta.link"
9
+ ></inner-link >
10
+ </transition-group >
11
+ </template >
12
+
13
+ <script >
14
+ import InnerLink from " ../InnerLink/index.vue"
15
+
16
+ export default {
17
+ components: { InnerLink },
18
+ computed: {
19
+ iframeViews () {
20
+ return this .$store .state .tagsView .iframeViews
21
+ }
22
+ }
23
+ }
24
+ </script >
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div :style =" 'height:' + height" v-loading =" loading" element-loading-text =" 正在加载页面,请稍候!" >
3
+ <iframe
4
+ :id =" iframeId"
5
+ style =" width : 100% ; height : 100% "
6
+ :src =" src"
7
+ frameborder =" no"
8
+ ></iframe >
9
+ </div >
10
+ </template >
11
+
12
+ <script >
13
+ export default {
14
+ props: {
15
+ src: {
16
+ type: String ,
17
+ default: " /"
18
+ },
19
+ iframeId: {
20
+ type: String
21
+ }
22
+ },
23
+ data () {
24
+ return {
25
+ loading: false ,
26
+ height: document .documentElement .clientHeight - 94.5 + " px;"
27
+ };
28
+ },
29
+ mounted () {
30
+ var _this = this ;
31
+ const iframeId = (" #" + this .iframeId ).replace (/ \/ / g , " \\ /" );
32
+ const iframe = document .querySelector (iframeId);
33
+ // iframe页面loading控制
34
+ if (iframe .attachEvent ) {
35
+ this .loading = true ;
36
+ iframe .attachEvent (" onload" , function () {
37
+ _this .loading = false ;
38
+ });
39
+ } else {
40
+ this .loading = true ;
41
+ iframe .onload = function () {
42
+ _this .loading = false ;
43
+ };
44
+ }
45
+ }
46
+ };
47
+ </script >
You can’t perform that action at this time.
0 commit comments