wujingjing
2024-12-11 3229f6a34f4982d1a551d86e68d313482e33f701
src/layout/routerView/iframes.vue
@@ -12,17 +12,21 @@
                  style="position: absolute"
                  :data-url="v.path"
                  v-if="getRoutePath === v.path"
                  @load="iframeLoad"
                  ref="iframeRef"
               />
            </transition-group>
         </div>
      </div>
      <AmisPageOptDlg v-model="amisPageShow" :item="amisPageMapRow" @insert="amisPageInsert" @update="amisPageUpdate" />
   </div>
</template>
<script setup lang="ts" name="layoutIframeView">
import { computed, watch, ref, nextTick } from 'vue';
import { useRoute } from 'vue-router';
import AmisPageOptDlg from '/@/views/project/yw/lowCode/sqlAmis/optDlg/OptDlg.vue';
import emitter from '/@/utils/mitt';
// 定义父组件传过来的值
const props = defineProps({
@@ -98,4 +102,32 @@
      deep: true,
   }
);
const iframeLoad = () => {
   setTimeout(() => {
      window.frames[0].openOptAmisPageDlg = () => {
         amisPageShow.value = true;
      };
      window.frames[0].updatePublished = (id, published) => {
         emitter.emit('supervisor.publish', {
            id,
            published,
         });
      };
   }, 0);
};
//#region ====================== iframe 交互 ======================
const amisPageShow = ref(false);
const amisPageMapRow = ref(null);
const amisPageInsert = (...params) => {
   window.frames?.[0]?.amisPageInsert?.(...params);
};
const amisPageUpdate = (...params) => {
   window.frames?.[0]?.amisPageUpdate?.(...params);
};
//#endregion
</script>