VUE使用富文本编译器wangeditor,解决* core-js/modules/es.object.to-string.js in ./node_modules/@babel/runtime/he
VUE使用富文本编译器wangeditor解决* core-js/modules/es.object.to-string.js in ./node_modules/@babel/runtime/he报错1.终端安装wangeditornpm install wangeditor2.这个时候可能会报* core-js/modules/es.object.to-string.js in ./node_
·
VUE使用富文本编译器wangeditor
解决* core-js/modules/es.object.to-string.js in ./node_modules/@babel/runtime/he报错
1.终端安装wangeditor
npm install wangeditor
2.这个时候可能会报* core-js/modules/es.object.to-string.js in ./node_modules/@babel/runtime/he。不用担心,依赖的问题。下载一下就好了。
1.停止运行
2.终端安装依赖
npm install --save core-js
这样就好了
3.使用富文本编译器
- 首先在VUE文件中导入
import E from 'wangeditor'
- 创建实例,绑定对象
mounted(){
let editor = new E('#app'); //创建实例 并绑定对象
editor.create(); //创建富文本框
},
- ok了 运行一下
4.再来获取一下文本框的内容吧
<template>
<div>
<div id="div">
</div>
<el-button type="primary" @click="getTitle()">注册</el-button>
</div>
</template>
<script>
import E from 'wangeditor'
var a = null
export default {
name: 'report',
mounted () {
a = new E('#div')
a.create()
},
methods: {
getTitle () {
console.log(a.txt.html())
}
}
}
</script>
<style scoped>
</style>
效果如图:
再进行处理就能存储在数据库上了。很方便。
更多推荐
已为社区贡献1条内容
所有评论(0)