123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <template>
- <div>
- <script id="editor" type="text/plain" ></script>
- </div>
- </template>
- <script>
- import '@/assets/static/ueditor/ueditor.config.js'
- import '@/assets/static/ueditor/ueditor.all.js'
- import '@/assets/static/ueditor/lang/zh-cn/zh-cn.js'
- export default {
- name: 'UEditor',
- props: {
- id: {
- type: String
- },
- config: {
- type: Object
- }
- },
- data () {
- return {
- editor: null
- }
- },
- mounted () {
- // 初始化UE
- const _this = this
- this.editor = UE.delEditor('editor')
- this.editor = UE.getEditor('editor', this.config)
- },
- destoryed () {
- this.editor.destory()
- },
- methods: {
- getUEContent: function () {
- return this.editor.getContent()
- },
- setContent: function (content) {
- const ue = UE.getEditor('editor')
- ue.ready(function () {
- ue.setContent(content)
- })
- },
- getContentTxt: function () {
- return this.editor.getContentTxt()
- }
- }
- }
- </script>
|