refactor:change MdEditor to MarkdownEditor

This commit is contained in:
Pan 2017-10-26 14:06:32 +08:00
parent 2c82d0a28e
commit 5b3b8b87d1

View file

@ -2,7 +2,7 @@
<div class="components-container"> <div class="components-container">
<code>Markdown 我们这里选用了 <a href="https://github.com/sparksuite/simplemde-markdown-editor" target="_blank">simplemde-markdown-editor</a> 简单的用vue封装了一下<a target='_blank' href='https://segmentfault.com/a/1190000009762198#articleHeader14'> 相关文章 </a></code> <code>Markdown 我们这里选用了 <a href="https://github.com/sparksuite/simplemde-markdown-editor" target="_blank">simplemde-markdown-editor</a> 简单的用vue封装了一下<a target='_blank' href='https://segmentfault.com/a/1190000009762198#articleHeader14'> 相关文章 </a></code>
<div class="editor-container"> <div class="editor-container">
<md-editor id='contentEditor' ref="contentEditor" v-model='content' :height="300" :zIndex='20'></md-editor> <markdown-editor id='contentEditor' ref="contentEditor" v-model='content' :height="300" :zIndex='20'></markdown-editor>
</div> </div>
<el-button @click='markdown2Html' style="margin-top:80px;" type="primary">转为HTML<i class="el-icon-document el-icon--right"></i></el-button> <el-button @click='markdown2Html' style="margin-top:80px;" type="primary">转为HTML<i class="el-icon-document el-icon--right"></i></el-button>
<div v-html="html"></div> <div v-html="html"></div>
@ -10,16 +10,27 @@
</template> </template>
<script> <script>
import MdEditor from '@/components/MarkdownEditor' import MarkdownEditor from '@/components/MarkdownEditor'
export default { export default {
components: { MdEditor }, components: { MarkdownEditor },
data() { data() {
return { return {
content: '## Simplemde', content: '## Simplemde',
html: '' html: ''
} }
}, },
computed: {
cachedViews() {
return this.$store.state.app.cachedViews
}
},
// deactivated() {
// console.log(this.cachedViews.indexOf(this.$route.name))
// if (this.cachedViews.indexOf(this.$route.name) < 0) {
// this.$destroy()
// }
// },
methods: { methods: {
markdown2Html() { markdown2Html() {
import('showdown').then(showdown => { import('showdown').then(showdown => {