<template>
  <div class="wps-reader">
    <div id="viewFile" class="file-container"></div>
    <RightPanel />
  </div>
</template>
<script>
import WebOfficeSDK from "/public/weboffice/web-office-sdk-v1.1.8.es";
import RightPanel from "./component/rightPanel.vue";
export default {
  components: {
    RightPanel,
  },
  mounted() {
    // // this.getBookList();
    // console.log("WebOfficeSDK", WebOfficeSDK);
    this.openWps(this.$route.query.wpsUrl, this.$route.query.token);
  },
  methods: {
    async openWps(url, token) {
      this.wps = WebOfficeSDK.config({
        wpsUrl: url, // 如果需要通过js-sdk传递token方式鉴权，则需要包含_w_tokentype=1参数
        mount: document.querySelector("#viewFile"),
      });
      console.log("this.wps", this.wps);
      this.wps.setToken({ token });
      this.wps.ready();
    },
  },
};
</script>
<style lang="scss" scoped>
.wps-reader {
  display: flex;
  .file-container {
    width: 80vw;
    height: 100vh;
    overflow: hidden;
  }
}
</style>
