tst
feige
2023-03-24 9452f0d7e15529fbde88071d68387d70e7b83c22
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<template>
  <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>