<template>
  <div>
    <cadPreview
      :documentId="documentsId"
      :accessToken="tokenTes"
      :write="false"
      v-if="tokenTes"
    ></cadPreview>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue';
import { getThirdToken } from '@/utils/commonMethonds';
import cadPreview from '@/views/components/cadPreview.vue';
export default defineComponent({
  components: { cadPreview },
  name: 'crownCAD',
  setup() {
    //TODO： documentsId 目前需要通过项目去创建文档，并生成对应的文档ID
    // 或者通过调用新建文档接口
    // 也可以直接通过调用 /thirdparty/inventory 进入项目，进行创建
    const documentsId = ref('63dcce4e13f6f37d0f7c4ba4');
    // accessToken 从 /thirdparty/token 接口返回值中取到
    const tokenTes = ref();
    getThirdToken().then((res: string) => {
      tokenTes.value = res;
    });
    return {
      tokenTes,
      documentsId,
    };
  },
});
</script>
<style lang="less" scoped></style>
