Parcourir la source

refactor: 使用iframe替代自定义组件预览

yusheng il y a 2 mois
Parent
commit
b4babc0a83
1 fichiers modifiés avec 15 ajouts et 15 suppressions
  1. 15 15
      src/views/doc/components/browse.vue

+ 15 - 15
src/views/doc/components/browse.vue

@@ -22,25 +22,25 @@
       append-to-body
       :fullscreen="true"
     >
-      <!-- <iframe
+      <iframe
         :src="fileUrl"
         width="60%"
         v-if="showEditFlag"
         style="height: calc(100vh - 100px)"
         frameborder="0"
         allowfullscreen="true"
-      ></iframe> -->
-      <aa ref="aa"></aa>
+      ></iframe>
+      <!-- <aa ref="aa"></aa> -->
     </ele-modal>
   </div>
 </template>
 
 <script>
   import { setFileUrl } from '../util.js';
-  import aa from './aa.vue';
+  // import aa from './aa.vue';
 
   export default {
-    components: { aa },
+    // components: { aa },
     data() {
       return {
         fileType: 1,
@@ -53,17 +53,17 @@
 
     methods: {
       open() {
-        // window.open(this.fileUrl);
+        window.open(this.fileUrl);
         this.showEditFlag = true;
-        var iframe = document.getElementById('Iframe');
-        var iframeDocument = iframe.contentWindow.document;
-        var container = iframeDocument.querySelectorAll('.container');
-        this.$refs.aa.init(
-          container[0].innerHTML.replace(
-            /src="https?:\/\/[^\/]+(\/[^"]*)"/g,
-            `src="${window.location.origin}$1"`
-          )
-        );
+        // var iframe = document.getElementById('Iframe');
+        // var iframeDocument = iframe.contentWindow.document;
+        // var container = iframeDocument.querySelectorAll('.container');
+        // this.$refs.aa.init(
+        //   container[0].innerHTML.replace(
+        //     /src="https?:\/\/[^\/]+(\/[^"]*)"/g,
+        //     `src="${window.location.origin}$1"`
+        //   )
+        // );
       },
       setFileUrl(row) {
         this.loading = true;