add vditor
This commit is contained in:
1 parent
8135b02e1e
commit
01021b1a5f
7 files changed
+649
-1
No files matched your search
@@ -0,0 +1,54 @@
|
||||
<template>
|
||||
<layout-editor>
|
||||
<template v-slot:main>
|
||||
<div id="vditor" class="vditor" />
|
||||
</template>
|
||||
</layout-editor>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { LayoutEditor } from '@/layouts/index';
|
||||
import Vditor from 'vditor';
|
||||
import { defaultOptions } from '@/settings/editor';
|
||||
export default {
|
||||
components: {
|
||||
LayoutEditor
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
vditor: null
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.initVditor();
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
initVditor() {
|
||||
const options = {
|
||||
width: this.isMobile ? '100%' : '80%',
|
||||
height: '0',
|
||||
tab: '\t',
|
||||
mode: 'ir',
|
||||
icon: 'material',
|
||||
debugger: false,
|
||||
after: () => {
|
||||
this.vditor.setValue('');
|
||||
}
|
||||
};
|
||||
this.vditor = new Vditor('vditor', {
|
||||
...defaultOptions,
|
||||
...options
|
||||
});
|
||||
this.vditor.focus();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.vditor {
|
||||
margin: 50px auto;
|
||||
height: calc(100vh - 200px);
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user