动态更改 Quill 占位符 [英] Dynamically change Quill placeholder

查看:70
本文介绍了动态更改 Quill 占位符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道在实例化 Quill 编辑器时,有一个占位符选项.有没有办法在编辑器实例化后动态更改此占位符?

I know that on instantiation of a Quill editor, there is a placeholder option. Is there a way that I can change this placeholder dynamically after the editor is instantiated?

推荐答案

占位符是通过 CSS 规则实现的:

The placeholder is implemented with a CSS rule:

.ql-editor::before { 
   content: attr(data-placeholder);
}

所以你可以做 quill.root.dataset.placeholder = 'Your new placeholder';

这篇关于动态更改 Quill 占位符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆