vue引入 wps在线编辑版,可进行 预览,编辑, 打印等功能。

时间:2025-02-14 10:32:05
<template> <div id="viewFile"></div> </template> <script> export default { props:['wpsUrl','token'], data(){ return{ // 是否开启简易模式 simpleMode:false, } }, mounted(){ this.openWps(this.wpsUrl,this.token); }, methods:{ openWps(url, token) { let _this = this; const wps = _this.wps.config({ mode: _this.simpleMode?'simple':'normal', mount: document.querySelector('#layoutBox'), wpsUrl: url, commonOptions: { isShowTopArea: true, // 隐藏顶部区域(头部和工具栏) isShowHeader: false, // 隐藏头部区域, }, // commandBars: [ // // 可以配置多个组件 // { // cmbId: "Print", // attributes: [{ // name: "visible", // value: false // }] // }, // { // cmbId: "HeaderRight", // attributes: [{ // name: "visible", // value: false // }] // } // ] }); wps.setToken({"token": token}); } </script>