82 lines
2.1 KiB
Vue
82 lines
2.1 KiB
Vue
<template>
|
|
<!-- style="margin-top:43px"-->
|
|
<div>
|
|
<h3 :style="{ margin: '16px 0' }" v-show="!!title">
|
|
{{ title }}
|
|
</h3>
|
|
<a-list size="small" bordered :data-source="list">
|
|
<a-list-item slot="renderItem" slot-scope="item, index">
|
|
<span style="cursor: pointer;" @click="handleClick(item, index)">
|
|
{{ item }}
|
|
</span>
|
|
</a-list-item>
|
|
</a-list>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import Vue from 'vue'
|
|
import { SEPARATOR_TYPE } from '@/pages/page1/common/utils'
|
|
|
|
export default {
|
|
props: {
|
|
// ctx: {
|
|
// type: Object,
|
|
// required: true
|
|
// }
|
|
title: {
|
|
type: String,
|
|
required: false
|
|
},
|
|
list: {
|
|
type: Array,
|
|
required: true
|
|
},
|
|
separatorText: {
|
|
type: [Number, String],
|
|
default: ' '
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
data: [
|
|
'下列术语和定义适用于本标准',
|
|
'××××××(标准编号)中确立的以及下列术语和定义适用于本标准'
|
|
]
|
|
}
|
|
},
|
|
methods: {
|
|
handleClick(item, index) {
|
|
window.Asc.scope.text = item // export variable to plugin scope
|
|
window.Asc.scope.separatorText = this.separatorText // export variable to plugin scope
|
|
// window.Asc.plugin.init = function () {
|
|
// eslint-disable-next-line func-names
|
|
// eslint-disable-next-line prefer-arrow-callback
|
|
this.ctx.callCommand(function () {
|
|
try {
|
|
// eslint-disable-next-line no-undef
|
|
const oDocument = Api.GetDocument()
|
|
// eslint-disable-next-line no-undef
|
|
const oParagraph = Api.CreateParagraph()
|
|
|
|
// eslint-disable-next-line no-undef
|
|
oParagraph.AddText(Asc.scope.text) // or oParagraph.AddText(scope.text);
|
|
// const oRun = oParagraph.AddLineBreak()
|
|
// oRun.AddText(`xxxxxx${Asc.scope.separatorText}xxxxxx`)
|
|
oDocument.InsertContent([oParagraph])
|
|
let GetNext = oParagraph.GetNext()
|
|
GetNext.Delete()
|
|
} catch (error) {
|
|
console.error(error)
|
|
}
|
|
}, false)
|
|
// }
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
|
|
</style>
|