您的位置:首页 > 产品设计 > UI/UE

vue使用vue-ueditor碰到的问题(Couldn't find preset "es2015" relative to directory)

2017-04-15 17:35 579 查看
1、安装vue-ueditor

npm i vue-ueditor --S

将安装包下面的UEditor
代码包复制到项目static目录下面

UEditor
代码包(\node_modules\vue-ueditor\static\ueditor1_4_3_3)或者在下载最新源码和各个语言版本的http://ueditor.baidu.com/website/download.html#ueditor

2、使用

<template>
<div>
<p>fdgdgd</p>
<VueEditor ueditorPath="../../static/ueditor1_4_3_3-utf8-net" @ready="editorReady"></VueEditor>
</div>
</template>
import  VueEditor from  'vue-ueditor'
components:{
VueEditor
},
methods:{
editorReady(editorInstance){
editorInstance.setContent('Hello world!<br>编辑初始化内容')
}
}


3、Couldn't find preset "es2015" relative to directory问题解决
由于是菜鸟没使用ES标准,而引入的vue-ueditor使用了ES标准,所以编译会报错,解决办法如下:

npm i
a252
nstall babel-preset-es2015 --save-dev

然后需要在webpack.base.conf.js文件中加入如下代码

module: {
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
query: {
presets: ['es2015']
}
}
]
}

ok,现在可以使用vue-uediter了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐