100 lines
3.3 KiB
JavaScript
100 lines
3.3 KiB
JavaScript
import { i as ElIcon, a7 as loading_default } from "./element-plus.CkEW9frc.js";
|
|
import { J as defineComponent, m as watch, t as onMounted, n as nextTick, _ as createElementBlock, a1 as createBaseVNode, o as unref, $ as createVNode, a0 as withCtx, a8 as createCommentVNode, dZ as useRoute, r as ref, j as computed, S as openBlock } from "./.pnpm.BW3P1y8f.js";
|
|
import { g as useTagsViewStore } from "./index.CMd5bD1r.js";
|
|
import { _ as _export_sfc } from "./_plugin-vue_export-helper.1tPrXgE0.js";
|
|
import "./codemirror.CvJAcn2d.js";
|
|
const _hoisted_1 = { class: "internal-app-container" };
|
|
const _hoisted_2 = { class: "internal-app-content" };
|
|
const _hoisted_3 = ["src"];
|
|
const _hoisted_4 = {
|
|
key: 0,
|
|
class: "loading-overlay"
|
|
};
|
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
...{
|
|
name: "InternalApp",
|
|
inheritAttrs: false
|
|
},
|
|
__name: "InternalApp",
|
|
setup(__props) {
|
|
const route = useRoute();
|
|
const tagsViewStore = useTagsViewStore();
|
|
const iframeRef = ref();
|
|
const loading = ref(true);
|
|
const appUrl = computed(() => route.query.url);
|
|
const appName = computed(() => route.query.appName);
|
|
function handleIframeLoad() {
|
|
loading.value = false;
|
|
}
|
|
watch(
|
|
() => route.query.url,
|
|
(newUrl) => {
|
|
if (newUrl && iframeRef.value) {
|
|
loading.value = true;
|
|
iframeRef.value.src = newUrl;
|
|
}
|
|
}
|
|
);
|
|
onMounted(() => {
|
|
if (appName.value) {
|
|
nextTick(() => {
|
|
const currentTag = tagsViewStore.visitedViews.find((tag) => tag.path === route.path);
|
|
if (currentTag && currentTag.title !== appName.value) {
|
|
tagsViewStore.updateVisitedView({
|
|
...currentTag,
|
|
title: appName.value,
|
|
fullPath: route.fullPath,
|
|
query: route.query
|
|
});
|
|
}
|
|
});
|
|
}
|
|
});
|
|
watch(
|
|
() => appName.value,
|
|
(newAppName) => {
|
|
if (newAppName) {
|
|
const currentTag = tagsViewStore.visitedViews.find((tag) => tag.path === route.path);
|
|
if (currentTag) {
|
|
tagsViewStore.updateVisitedView({
|
|
...currentTag,
|
|
title: newAppName,
|
|
fullPath: route.fullPath,
|
|
query: route.query
|
|
});
|
|
}
|
|
}
|
|
}
|
|
);
|
|
return (_ctx, _cache) => {
|
|
const _component_el_icon = ElIcon;
|
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
createBaseVNode("div", _hoisted_2, [
|
|
createBaseVNode("iframe", {
|
|
ref_key: "iframeRef",
|
|
ref: iframeRef,
|
|
src: unref(appUrl),
|
|
class: "internal-app-iframe",
|
|
frameborder: "0",
|
|
allowfullscreen: "",
|
|
onLoad: handleIframeLoad
|
|
}, null, 40, _hoisted_3),
|
|
unref(loading) ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
createVNode(_component_el_icon, { class: "loading-icon" }, {
|
|
default: withCtx(() => [
|
|
createVNode(unref(loading_default))
|
|
]),
|
|
_: 1
|
|
}),
|
|
_cache[0] || (_cache[0] = createBaseVNode("span", null, "加载中...", -1))
|
|
])) : createCommentVNode("", true)
|
|
])
|
|
]);
|
|
};
|
|
}
|
|
});
|
|
const InternalApp = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f92c86f7"]]);
|
|
export {
|
|
InternalApp as default
|
|
};
|