|
@@ -1,9 +1,11 @@
|
|
|
import { ItemObject } from "@/modules/list/objects/item";
|
|
|
import { css } from "@linaria/core";
|
|
|
-import { defineComponent, onMounted, reactive, ref } from "vue";
|
|
|
+import { defineComponent, nextTick, onMounted, reactive, ref } from "vue";
|
|
|
import { any, object } from "vue-types";
|
|
|
|
|
|
import SwiperImage from "./swiperImage";
|
|
|
+import { useCtx } from "@/comm/ctx";
|
|
|
+import { useList } from "@/modules/list";
|
|
|
|
|
|
// import Quill from "quill";
|
|
|
export default defineComponent({
|
|
@@ -21,6 +23,9 @@ export default defineComponent({
|
|
|
// });
|
|
|
const moveRef = ref<HTMLElement>();
|
|
|
const ifRef = ref<HTMLIFrameElement>();
|
|
|
+ const ifRefView = ref<HTMLElement>();
|
|
|
+ const { previewCtrl } = useCtx();
|
|
|
+ const { actions } = useList();
|
|
|
// const editorRef = ref<HTMLElement>();
|
|
|
onMounted(() => {
|
|
|
// if (props.data.desc) {
|
|
@@ -34,21 +39,30 @@ export default defineComponent({
|
|
|
moveRef.value?.addEventListener("mousedown", (e) => {
|
|
|
emit("move", true);
|
|
|
});
|
|
|
- window.addEventListener("message", (e) => {
|
|
|
- try {
|
|
|
- if (!e.data || typeof e.data != "string") {
|
|
|
- return;
|
|
|
- }
|
|
|
- const data = JSON.parse(e.data);
|
|
|
- if (data.type == "ready") {
|
|
|
- ifRef.value?.contentWindow?.postMessage(
|
|
|
- JSON.stringify({ type: "data", data: props.data })
|
|
|
- );
|
|
|
- }
|
|
|
- } catch (e) {
|
|
|
- console.log(e);
|
|
|
- }
|
|
|
+ nextTick(async () => {
|
|
|
+ previewCtrl.setIframeParent(ifRefView.value as HTMLElement);
|
|
|
+ // previewCtrl.setLastIframe(ifRef.value as HTMLIFrameElement)
|
|
|
+ const res = await actions.loadPack3d({
|
|
|
+ source: props.data?.source,
|
|
|
+ } as any);
|
|
|
+ previewCtrl.priewViewScene(res?.data);
|
|
|
});
|
|
|
+
|
|
|
+ // window.addEventListener("message", (e) => {
|
|
|
+ // try {
|
|
|
+ // if (!e.data || typeof e.data != "string") {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // const data = JSON.parse(e.data);
|
|
|
+ // if (data.type == "ready") {
|
|
|
+ // ifRef.value?.contentWindow?.postMessage(
|
|
|
+ // JSON.stringify({ type: "data", data: props.data })
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+ // } catch (e) {
|
|
|
+ // console.log(e);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
});
|
|
|
// const descTigger = () => {
|
|
|
// state.descShow = !state.descShow;
|
|
@@ -103,22 +117,17 @@ export default defineComponent({
|
|
|
</div>
|
|
|
)} */}
|
|
|
|
|
|
- <div class={"view_3d"}>
|
|
|
- <iframe
|
|
|
+ <div class={"view_3d"} ref={ifRefView}>
|
|
|
+ {/* <iframe
|
|
|
ref={ifRef}
|
|
|
- src={
|
|
|
- "./frame3d.html#/?source=" +
|
|
|
- props.data?.source +
|
|
|
- "&dialogid=" +
|
|
|
- props.dialogId
|
|
|
- }
|
|
|
+ src={"/frame3d.html"}
|
|
|
allowtransparency="true"
|
|
|
style={{ backgroundColor: "transparent" }}
|
|
|
frameborder="0"
|
|
|
width="100%"
|
|
|
height="100%"
|
|
|
scrolling="no"
|
|
|
- />
|
|
|
+ /> */}
|
|
|
</div>
|
|
|
|
|
|
{/* {data?.desc && (
|