相关链接
下载 JS-SDK
在使用之前,请先下载最新版本的 js-sdk 代码。
引用 JS-SDK
1
| <script src="web-office-sdk.umd.js"></script>
|
1
| let WebOfficeSDK = require("./web-office-sdk.cjs.js");
|
1
| import WebOfficeSDK from "./web-office-sdk.es.js";
|
使用
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
| <template> <div class="wps"><div class="custom-mount"></div></div> </template> <script setup lang="ts"> import { onMounted } from "vue"; import WebOfficeSDK from './web-office-sdk.es.js'; const init = async () => { const url = ''; const token = ""; const wps = WebOfficeSDK.config({ url: url, mount: document.querySelector(".custom-mount")!, }); wps.setToken({ token: token, timeout: 10000, }); }; onMounted(() => { init(); }); </script> <style lang="less" scoped> .wps { width: 100%; height: 900px; background-color: #66ccff; .custom-mount { width: 100%; height: 100%; } } </style>
|