Skip to content
On this page

Vue 2.x

安装

sh
npm install --save document-editor-vue

or

sh
yarn add document-editor-vue -S

使用示例

vue
<template>
  <DocumentEditor 
    id="docEditor" 
    :documentServerUrl="documentServerUrl"
    :config="config"
    :events_onDocumentReady="onDocumentReady"
    /> 
</template>

<script>
import { DocumentEditor } from "document-editor-vue";
 
export default {
  name: 'ExampleComponent',
  components: {
    DocumentEditor
  },
  data() {
    return {
      documentServerUrl:"http://10.10.31.157:7008/web-apps/apps/api/documents/api.js",
      config: {
        document: {
          fileType: "docx",
          key: "Khirz6zTPdfd7",
          title: "Example Document Title.docx",
          url: "https://example.com/url-to-example-document.docx"
        },
        documentType: "word",
        editorConfig: {
          callbackUrl: "https://example.com/url-to-callback.ashx"
        }
      }
    }
  },
  methods: {
    onDocumentReady() {
      console.log("Document is loaded");
    }
  },
};
</script>

Props

名 称
类 型
默 认
必 填
描 述
idstringnulltrue组件唯一标识
documentServerUrlstringnulltrue文档服务器地址
configobjectnulltrue用于打开带有token的文件的通用配置对象
document_fileTypestringnullfalse文件类型
document_titlestringnullfalse文件名称
documentTypestringnullfalse文档类型
heightstringnullfalse窗口高度
typestringnullfalse终端类型 desktop, mobile, embedded
widthstringnullfalse窗口宽度
events_onAppReady(event: object) => voidnullfalse应用初始化
events_onDocumentStateChange(event: object) => voidnullfalse文档修改
events_onMetaChange(event: object) => voidnullfalse通过meta命令更改文档的元信息
events_onDocumentReady(event: object) => voidnullfalse文档加载
events_onInfo(event: object) => voidnullfalse应用程序打开了文件
events_onWarning(event: object) => voidnullfalse出现警告
events_onError(event: object) => voidnullfalse出现错误
events_onRequestSharingSettings(event: object) => voidnullfalse点击置管理文档访问权限
events_onRequestRename(event: object) => voidnullfalse点击重命名
events_onMakeActionLink(event: object) => voidnullfalse点击书签获取链接,定位书签
events_onRequestInsertImage(event: object) => voidnullfalse点击插入图片
events_onRequestSaveAs(event: object) => voidnullfalse点击另存为
events_onRequestMailMergeRecipients(event: object) => voidnullfalse点击选择收件人数据
events_onRequestCompareFile(event: object) => voidnullfalse点击文档比对
events_onRequestEditRights(event: object) => voidnullfalse点击编辑按钮
events_onRequestHistory(event: object) => voidnullfalse点击历史版本
events_onRequestHistoryClose(event: object) => voidnullfalse关闭历史版本
events_onRequestHistoryData(event: object) => voidnullfalse点击特定版本
events_onRequestRestore(event: object) => voidnullfalse点击恢复版本按钮




如果有帮助到您,请作者喝杯咖啡吧