vue使用富文本编辑器vue-ueditor

2017-06-01  本文已影响0人  power__c081

vue使用富文本编辑器vue-ueditor

npm i vue-ueditor --S

组件里面只需要写

<template>

<vueUEditor></vueUEditor>

</template>

<script>

import vueUEditor from 'vue-ueditor';

export default {

components:{vueUEditor,},

methods:{

editorready(editorInstance){editorInstance.set('hellowor!');

editorInstance.addListener('contentChange',()=>{console.log('编辑器发生变化',editorInstance.getContent())})}}}

</script>

如果遇到Couldn't find preset "es2015" relative to directory问题

npm install babel-preset-es2015 --save-dev

webpack.base.conf.js配置

loaders: [{

test: /\.js$/,

exclude: /(node_modules|bower_components)/,

loader: 'babel',

query: {

presets: ['es2015']

}}]

上一篇 下一篇

猜你喜欢

热点阅读