Skip to content

Commit a0c5d89

Browse files
committed
'优化编辑器页面'
1 parent 88cef3b commit a0c5d89

File tree

6 files changed

+18
-27
lines changed

6 files changed

+18
-27
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"axios": "^0.15.3",
1414
"babel-polyfill": "^6.23.0",
1515
"element-ui": "2.3.3",
16+
"mavon-editor": "^2.5.2",
1617
"vue": "^2.5.16",
1718
"vue-core-image-upload": "2.1.11",
1819
"vue-datasource": "1.0.12",

src/components/common/Sidebar.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
title: '自述文件'
3737
},
3838
{
39-
icon: 'el-icon-menu',
39+
icon: 'el-icon-tickets',
4040
index: '2',
4141
title: '常用表格',
4242
subs: [
@@ -97,6 +97,7 @@
9797
}
9898
},
9999
created(){
100+
// 通过 Event Bus 进行组件间通信,来折叠侧边栏
100101
bus.$on('collapse', msg => {
101102
this.collapse = msg;
102103
})

src/components/page/BaseTable.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="table">
33
<div class="crumbs">
44
<el-breadcrumb separator="/">
5-
<el-breadcrumb-item><i class="el-icon-menu"></i> 表格</el-breadcrumb-item>
5+
<el-breadcrumb-item><i class="el-icon-tickets"></i> 表格</el-breadcrumb-item>
66
<el-breadcrumb-item>基础表格</el-breadcrumb-item>
77
</el-breadcrumb>
88
</div>

src/components/page/Markdown.vue

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,28 @@
88
</div>
99
<div class="container">
1010
<div class="plugins-tips">
11-
Vue-SimpleMDE:Vue.js的Markdown Editor组件。
12-
访问地址:<a href="https://github.com/F-loat/vue-simplemde" target="_blank">Vue-SimpleMDE</a>
13-
</div>
14-
<markdown-editor v-model="content" :configs="configs" ref="markdownEditor"></markdown-editor>
15-
<div class="plugins-tips">
16-
<p>既然用了markdown语法了,那么就有一个很实际的问题了。要怎么在前台展示数据呢?</p>
17-
<br>
18-
<p>这个时候就需要解析markdown语法了。可以使用 <a href="https://github.com/miaolz123/vue-markdown" target="_blank">vue-markdown</a>:一个基于vue.js的markdown语法解析插件。(这里不作展开,有需要自行了解)</p>
11+
mavonEditor:基于Vue的markdown编辑器。
12+
访问地址:<a href="https://github.com/hinesboy/mavonEditor" target="_blank">mavonEditor</a>
1913
</div>
14+
<mavon-editor v-model="content" codeStyle="tomorrow-night-blue" style="min-height: 600px"/>
15+
2016
</div>
2117
</div>
2218
</template>
2319

2420
<script>
25-
import { markdownEditor } from 'vue-simplemde';
21+
import { mavonEditor } from 'mavon-editor'
22+
import 'mavon-editor/dist/css/index.css'
2623
export default {
2724
data: function(){
2825
return {
2926
content:'',
3027
configs: {
31-
status: true,
32-
initialValue: 'Hello BBK',
33-
renderingConfig: {
34-
codeSyntaxHighlighting: true,
35-
highlightingTheme: 'atom-one-light'
36-
}
3728
}
3829
}
3930
},
4031
components: {
41-
markdownEditor
32+
mavonEditor
4233
}
4334
}
4435
</script>

src/components/page/VueEditor.vue

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,23 @@
1111
Vue-Quill-Editor:基于Quill、适用于Vue2的富文本编辑器。
1212
访问地址:<a href="https://github.com/surmon-china/vue-quill-editor" target="_blank">vue-quill-editor</a>
1313
</div>
14-
<quill-editor ref="myTextEditor" v-model="content" :config="editorOption"></quill-editor>
14+
<quill-editor ref="myTextEditor" v-model="content" :options="editorOption"></quill-editor>
1515
<el-button class="editor-btn" type="primary" @click="submit">提交</el-button>
1616
</div>
1717
</div>
1818
</template>
1919

2020
<script>
21+
import 'quill/dist/quill.core.css';
22+
import 'quill/dist/quill.snow.css';
23+
import 'quill/dist/quill.bubble.css';
2124
import { quillEditor } from 'vue-quill-editor';
2225
export default {
2326
data: function(){
2427
return {
25-
content: '<p>Hello BBK</p>',
28+
content: '',
2629
editorOption: {
27-
// something config
30+
placeholder: 'Hello World'
2831
}
2932
}
3033
},
@@ -39,11 +42,6 @@
3942
console.log(this.content);
4043
this.$message.success('提交成功!');
4144
}
42-
},
43-
computed: {
44-
editor() {
45-
return this.$refs.myTextEditor.quillEditor;
46-
}
4745
}
4846
}
4947
</script>

src/router/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default new Router({
3838
{
3939
// markdown组件
4040
path: '/markdown',
41-
component: resolve => require(['../components/page/VueEditor.vue'], resolve)
41+
component: resolve => require(['../components/page/Markdown.vue'], resolve)
4242
},
4343
{
4444
// Vue-Core-Image-Upload组件

0 commit comments

Comments
 (0)