nav-view-vessel.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div class="view-vessel">
  3. <div class="a-view" v-for="tab in $root.viewList" :key="tab.id"
  4. :class="tab == $root.nativeTab ? 'a-view-native' : null">
  5. <!-- vue视图 -->
  6. <template v-if="tab.view">
  7. <component :is="tab.view" class="vue-com-view" v-if="tab.isNeedLoad"></component>
  8. </template>
  9. <!-- iframe视图 -->
  10. <template v-else>
  11. <iframe :src="tab.url" :id=" 'iframe-' + tab.id " v-if="tab.isNeedLoad" @load="onloadIframe(tab.id)"></iframe>
  12. </template>
  13. </div>
  14. <!-- tab被拖拽时的遮罩(下托拽:悬浮打开) -->
  15. <div class="shade-fox" v-if="$root.isDrag"
  16. @dragover="$event.preventDefault();"
  17. @drop="$event.preventDefault(); $event.stopPropagation(); $root.xfTab($root.dragTab); $root.closeTab($root.dragTab);">
  18. <span style="font-size: 24px;">拖拽至此:悬浮打开</span>
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. module.exports = {
  24. data() {
  25. return {}
  26. },
  27. methods: {
  28. // iframe加载完毕后清除其背景 loading 图标
  29. onloadIframe: function (iframeId) {
  30. // console.log('iframeId', iframeId);
  31. var iframe = document.querySelector('#iframe-' + iframeId);
  32. if (iframe != null) {
  33. iframe.parentElement.style.backgroundImage = 'none';
  34. }
  35. },
  36. },
  37. created() {
  38. }
  39. }
  40. </script>
  41. <style scoped>
  42. .view-vessel {
  43. height: 100%;
  44. position: relative;
  45. border: 0px #000 solid;
  46. }
  47. .a-view {
  48. width: 100%;
  49. height: 100%;
  50. background-color: #EEE;
  51. background: url(../index/admin-loading.gif) no-repeat center 50%;
  52. position: absolute;
  53. }
  54. .a-view {
  55. opacity: 0;
  56. transition: all 0.2s;
  57. }
  58. .a-view-native {
  59. z-index: 100000;
  60. opacity: 1;
  61. }
  62. .a-view > iframe {
  63. width: 100%;
  64. height: 100%;
  65. border: 0px #000 solid;
  66. }
  67. .a-view > .vue-com-view {
  68. width: 100%;
  69. height: 100%;
  70. overflow: auto;
  71. background-color: #EEE;
  72. }
  73. /* .iframe-no-scroll{width: calc(100% + 22px); } */
  74. </style>