uniapp解决editor富文本修改placeholder样式问题

在组件内部修改无效,所以选择在App.vue中加入修改样式,得以解决。

   /* 富文本颜色 placeholder: #c0c4cc */


  .ql-editor.ql-blank:before {
    color: #c0c4cc;
    font-size: 30rpx;
  }

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
Vue3 富文本组件可以使用@wangeditor/editor-for-vue库来实现。可以通过以下步骤来使用该组件: 1. 在Vue项目中安装该库: ``` npm install @wangeditor/editor @wangeditor/editor-for-vue@next ``` 2. 在Vue组件中引入所需的组件和样式: ```javascript import { Editor, Toolbar } from '@wangeditor/editor-for-vue' import '@wangeditor/editor/dist/css/style.css' ``` 3. 在Vue组件的模板中使用组件: ```html <template> <div class="tool-bar"> <!-- 工具栏 --> <Toolbar class="tool-style" :editor="editorRef" :defaultConfig="toolbarConfig" /> <!-- 编辑器 --> <Editor class="content" v-model="valueHtml" :defaultConfig="editorConfig" @onCreated="handleCreated" /> </div> </template> ``` 4. 在Vue组件的脚本中定义所需的变量和方法: ```javascript <script setup> import { onBeforeUnmount, ref, shallowRef } from 'vue' import { Editor, Toolbar } from '@wangeditor/editor-for-vue' const editorRef = shallowRef() const toolbarConfig = ref() // 内容 HTML const valueHtml = ref('<p></p>') // 编辑器配置 const editorConfig = { placeholder: '请输入内容...', MENU_CONF: { /* 菜单配置,下文解释 */ } } const handleCreated = (editor) => { editorRef.value = editor // 记录 editor 实例,重要! } // 组件销毁时,及时销毁编辑器 onBeforeUnmount(() => { const editor = editorRef.value if (editor == null) return editor.destroy() }) </script> ``` 以上是在Vue3中使用@wangeditor/editor-for-vue库实现富文本组件的基本步骤。你可以根据具体需求进行配置和定制化。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值