for my purpose,I just want to present a demo of onlyoffice。I simplified the process like that:
1.install the documentserver by docker
2.start the image by JWT_ENABLED=false
3.use the .vue file like that:
<template>
<DocumentEditor id="docEditor" documentServerUrl="http://192.168.31.64:8099/" :config="config"
:events_onDocumentReady="onDocumentReady" :onLoadComponentError="onLoadComponentError" height="100 %" />
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { DocumentEditor } from "@onlyoffice/document-editor-vue";
export default defineComponent({
name: 'ExampleComponent',
components: {
DocumentEditor
},
data() {
return {
config: {
document: {
fileType: "docx",
key: "Khirz6zTPdfd7",
title: "Example Document Title.docx",
url: "http://localhost:5173/test.docx"
},
documentType: "word",
// token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb2N1bWVudCI6eyJmaWxlVHlwZSI6ImRvY3giLCJrZXkiOiJLaGlyejZ6VFBkZmQ3IiwidGl0bGUiOiJFeGFtcGxlIERvY3VtZW50IFRpdGxlLmRvY3giLCJ1cmwiOiJodHRwczovL2V4YW1wbGUuY29tL3VybC10by1leGFtcGxlLWRvY3VtZW50LmRvY3gifSwiZG9jdW1lbnRUeXBlIjoid29yZCJ9.7IpEJxdOvBQ0kJ8l6ZegIV4tX5vsPbZZCDDVmcFROXc",
editorConfig: {
callbackUrl: "https://www.onlyoffice.com:443/callback.ashx?from=office-suite",
"mode": "edit",
},
height: '100%',
width: '100%'
}
}
},
methods: {
onDocumentReady() {
console.log("Document is loaded");
},
onLoadComponentError(errorCode, errorDescription) {
switch (errorCode) {
case -1: // Unknown error loading component
console.log(errorDescription);
break;
case -2: // Error load DocsAPI from http://documentserver/
console.log(errorDescription);
break;
case -3: // DocsAPI is not defined
console.log(errorDescription);
break;
}
}
},
});
</script>
it works,but still have some problems:the interface of onlyoffice is shown,but the content of docx file is not shown
when i clicked “word count”, it can count the total number of doc,how can i solve this question,thanks
for more details,here is the screenshot of browser’s DevTools (Console, Network tabs) when reproducing the issue:
brower console:
(sorry for chinese)
brower network:
thanks