Browse Source

[Feat 0000] CADViewer添加iframe功能

houzekong 11 months ago
parent
commit
27fa2964bc
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/components/CADViewer/src/CADViewer.vue

+ 8 - 1
src/components/CADViewer/src/CADViewer.vue

@@ -1,7 +1,8 @@
 <template>
   <div>
     <OperationBar v-if="showOperations" :allowed-operations="allowedOperations" :denied-operations="deniedOperations" />
-    <BasicViewer class="w-100% cad-viewer__viewer" :style="{ height: `${height}px` }" />
+    <iframe v-if="iframeMode" :src="iframeSrc" class="w-100% cad-viewer__viewer" :style="{ height: `${height}px` }"></iframe>
+    <BasicViewer v-else class="w-100% cad-viewer__viewer" :style="{ height: `${height}px` }" />
   </div>
 </template>
 <script setup lang="ts">
@@ -14,6 +15,10 @@
       /** CAD viewer 的高度,注意不是整个组件的高度 */
       height?: number;
       showOperations?: boolean;
+      /** 是否使用 iframe 代替客制化 CAD viewer */
+      iframeMode?: boolean;
+      /** CAD viewer 嵌入的 iframe src 描述 */
+      iframeSrc?: string;
       /** 设置允许展示的操作按钮,优先级高于 deniedOperations */
       allowedOperations?: SupportedOperationName[];
       /** 设置拒绝展示的操作按钮,优先级低于 allowedOperations */
@@ -21,7 +26,9 @@
     }>(),
     {
       height: 980,
+      iframeMode: true,
       showOperations: false,
+      iframeSrc: 'http://localhost:3366/',
     }
   );
 </script>