|
@@ -1,75 +0,0 @@
|
1
|
|
-<template>
|
2
|
|
- <div id="websiteEditorElem" style="height: 400px"/>
|
3
|
|
-</template>
|
4
|
|
-
|
5
|
|
-<script>
|
6
|
|
-import E from 'wangeditor'
|
7
|
|
-export default {
|
8
|
|
- name: 'Index',
|
9
|
|
- props: [
|
10
|
|
- // 'content'
|
11
|
|
- ],
|
12
|
|
- data() {
|
13
|
|
- return {
|
14
|
|
- text: this.content,
|
15
|
|
- phoneEditor: ''
|
16
|
|
- }
|
17
|
|
- },
|
18
|
|
- watch: {
|
19
|
|
- text(newVal, oldVal) {
|
20
|
|
- // this.phoneEditor.txt.html(this.text)
|
21
|
|
- if (!newVal && oldVal) {
|
22
|
|
- this.text = newVal
|
23
|
|
- this.intiPhoneEditor()
|
24
|
|
- }
|
25
|
|
- this.sendContent()
|
26
|
|
- }
|
27
|
|
- },
|
28
|
|
- mounted() {
|
29
|
|
- this.$nextTick(() => {
|
30
|
|
- this.intiPhoneEditor()
|
31
|
|
- })
|
32
|
|
- },
|
33
|
|
- methods: {
|
34
|
|
- sendContent() {
|
35
|
|
- this.$emit('get-content', this.text)
|
36
|
|
- },
|
37
|
|
- intiPhoneEditor() {
|
38
|
|
- const _that = this
|
39
|
|
- _that.phoneEditor = new E('#websiteEditorElem')
|
40
|
|
- const phoneEditor = _that.phoneEditor
|
41
|
|
- phoneEditor.customConfig.zIndex = 1
|
42
|
|
- phoneEditor.customConfig.onchange = function(html) {
|
43
|
|
- _that.text = html
|
44
|
|
- }
|
45
|
|
- // phoneEditor.customConfig.uploadImgServer = this.upFileUrl
|
46
|
|
- // phoneEditor.customConfig.uploadFileName = 'uploadFiles'
|
47
|
|
-
|
48
|
|
- // phoneEditor.customConfig.customUploadImg = function (files, insert) {
|
49
|
|
- // _that.uploadImg(files[0]).then(data => {
|
50
|
|
- // insert(data)
|
51
|
|
- // })
|
52
|
|
- // }
|
53
|
|
- phoneEditor.customConfig.menus = [
|
54
|
|
- 'head', // 标题
|
55
|
|
- 'bold', // 粗体
|
56
|
|
- 'fontSize', // 字号
|
57
|
|
- 'fontName', // 字体
|
58
|
|
- 'italic', // 斜体
|
59
|
|
- 'underline', // 下划线
|
60
|
|
- 'strikeThrough', // 删除线
|
61
|
|
- 'foreColor', // 文字颜色
|
62
|
|
- 'backColor', // 背景颜色
|
63
|
|
- 'justify', // 对齐方式
|
64
|
|
- 'image' // 插入图片
|
65
|
|
- ]
|
66
|
|
- phoneEditor.create()
|
67
|
|
- phoneEditor.txt.html(this.text)
|
68
|
|
- }
|
69
|
|
- }
|
70
|
|
-}
|
71
|
|
-</script>
|
72
|
|
-
|
73
|
|
-<style scoped>
|
74
|
|
-
|
75
|
|
-</style>
|