| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <!--onlyoffice 编辑器-->
- <template>
- <div>
- <div id="editorDiv" ref="editor" class="nav" />
- </div>
- </template>
- <script>
- export default {
- name: 'editor',
- data () {
- return {
- configKey: '',
- option: {}
- }
- },
- watch: {
- option: {
- handler (n, o) {
- this.setEditor(n)
- },
- deep: true
- }
- },
- mounted () {
- const temp = localStorage.getItem('templateOption')
- this.option = temp ? JSON.parse(temp) : {}
- if (this.$utils.isNotEmpty(this.option)) {
- this.setEditor(this.option)
- }
- },
- methods: {
- setEditor (option) {
- const config = {
- ...option,
- width: '100%',
- height: document.body.clientHeight + 'px'
- }
- const docEditor = new DocsAPI.DocEditor('editorDiv', config)
- this.configKey = config.document.key
- }
- }
- }
- </script>
|