From 9452f0d7e15529fbde88071d68387d70e7b83c22 Mon Sep 17 00:00:00 2001 From: feige <feige@qq.com> Date: 星期五, 24 三月 2023 10:53:06 +0800 Subject: [PATCH] tst --- src/views/Home.vue | 70 +++++++++++++++++++++++++++++++++++ 1 files changed, 70 insertions(+), 0 deletions(-) diff --git a/src/views/Home.vue b/src/views/Home.vue index 8bd6c57..d48ea05 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -2,17 +2,87 @@ <div class="home"> <img alt="Vue logo" src="../assets/logo.png"> <HelloWorld msg="Welcome to Your Vue.js App"/> + <div id = "mt"></div> </div> </template> <script> // @ is an alias to /src import HelloWorld from '@/components/HelloWorld.vue' +import { Launcher } from 'live-cat' export default { name: 'Home', components: { HelloWorld + }, + mounted() + { + }, + async created() + { + + this.get3d() + + alert(123) + + }, + methods: + { + async get3d() + { + let virtualEl = null + let answerList = [] + //useEffect(()=>{ + //bootstrap() + //},[]) + const appKey = "cGSdMdd6iarelspq"; +const address = "https://app.3dcat.live"; +const bootstrap = async () => { + try { + const launch = new Launcher({ + baseOptions: { + address, + appKey, + startType: 1, // 1:鏅�氶摼鎺� | 3:鎶曞睆閾炬帴 + optionalParam: 'resolution=${375}x${656} platform=mobile' + }, + + }); + //alert(12) + alert(launch.taskId) + const player = document.querySelector('#mt'); + //const player = document.querySelector("body"); + document.querySelector("body").style.width = "100vw"; + document.querySelector("body").style.height = "100vh"; + await launch.automata(player); + } catch (error) { + //alert(233) + //alert(error) + console.error(error); + } + } + window.addEventListener("DOMContentLoaded", () => { + if ( + navigator.userAgent.includes("miniProgram") || + navigator.userAgent.includes("MicroMessenger") + ) { + //寰俊娴忚鍣�/寰俊灏忕▼搴忕幆澧� + document.addEventListener("WeixinJSBridgeReady", bootstrap, false); + } else { + bootstrap(); + } +}); + }, } } </script> +<style> +#mt +{ + border:1px solid red; + width:375px; + height:656px; + position:relative; +} +</style> -- Gitblit v1.9.1