调整wang富文本编辑器层级

由于做了一个上传图片裁剪,被富文本挡住了,效果如下:
在这里插入图片描述
解决方式如下:

//添加样式即可
// wang富文本
.w-e-toolbar,
.w-e-menu,
.w-e-text-container,
.w-e-text {
  z-index: 1 !important; // 这是内容框
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1. 安装wang富文本编辑器 使用npm安装: ``` npm install wangEditor --save ``` 使用yarn安装: ``` yarn add wangEditor ``` 2. 在Vue组件中引入wang富文本编辑器 在需要使用富文本编辑器的组件中引入wang富文本编辑器: ```javascript import wangEditor from 'wangeditor' ``` 3. 初始化wang富文本编辑器 在组件的mounted生命周期钩子中初始化wang富文本编辑器: ```javascript mounted () { const editor = new wangEditor(this.$refs.editor) editor.create() } ``` 这里使用了ref来获取DOM元素,创建wangEditor实例并调用create()方法初始化富文本编辑器。 4. 获取富文本编辑器中的内容 在需要获取富文本编辑器中的内容时,可以使用wangEditor实例的txt或者html方法获取: ```javascript const editor = new wangEditor(this.$refs.editor) editor.create() // 获取纯文本内容 const content = editor.txt.text() // 获取HTML内容 const htmlContent = editor.txt.html() ``` 5. 设置富文本编辑器的内容 在需要设置富文本编辑器中的内容时,可以使用wangEditor实例的txt或者html方法设置内容: ```javascript const editor = new wangEditor(this.$refs.editor) editor.create() // 设置纯文本内容 editor.txt.text('这是一段纯文本内容') // 设置HTML内容 editor.txt.html('<p>这是一段HTML内容</p>') ``` 6. 完整代码 ```vue <template> <div> <div ref="editor"></div> <button @click="getContent">获取内容</button> </div> </template> <script> import wangEditor from 'wangeditor' export default { mounted () { const editor = new wangEditor(this.$refs.editor) editor.create() }, methods: { getContent () { const editor = new wangEditor(this.$refs.editor) editor.create() const content = editor.txt.text() console.log(content) } } } </script> ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值