|
@@ -71,7 +71,17 @@ export default defineComponent({
|
|
const dialogId = query.dialogid;
|
|
const dialogId = query.dialogid;
|
|
const packRef = ref();
|
|
const packRef = ref();
|
|
const state = reactive({ loaded: false, loading: true });
|
|
const state = reactive({ loaded: false, loading: true });
|
|
-
|
|
|
|
|
|
+ window.addEventListener("message", (e: any) => {
|
|
|
|
+ try {
|
|
|
|
+ const msgData = JSON.parse(e.data);
|
|
|
|
+ if (msgData.type == "data") {
|
|
|
|
+ packRef.value = msgData.data;
|
|
|
|
+ state.loaded = true;
|
|
|
|
+ }
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.log(e);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
// const res = await actions.loadPack3d({ meshId: meshId } as any);
|
|
// const res = await actions.loadPack3d({ meshId: meshId } as any);
|
|
// packRef.value = res?.data;
|
|
// packRef.value = res?.data;
|
|
@@ -88,13 +98,7 @@ export default defineComponent({
|
|
document.addEventListener("touchend", () => {
|
|
document.addEventListener("touchend", () => {
|
|
window.parent.postMessage(JSON.stringify({ type: "end", dialogId }));
|
|
window.parent.postMessage(JSON.stringify({ type: "end", dialogId }));
|
|
});
|
|
});
|
|
- window.addEventListener("message", (e) => {
|
|
|
|
- debugger;
|
|
|
|
- console.log(e);
|
|
|
|
- const data = JSON.parse(e.data);
|
|
|
|
- packRef.value = data;
|
|
|
|
- state.loaded = true;
|
|
|
|
- });
|
|
|
|
|
|
+ window.parent.postMessage(JSON.stringify({ type: "ready" }));
|
|
});
|
|
});
|
|
|
|
|
|
return () => {
|
|
return () => {
|