Ant Design Vue The default Textarea component does not have a word count function, but sometimes it is needed. Let me introduce how to make the Textarea component have a "word count" function. I hope it will be helpful to everyone!
Recommend a practical "word count" function:Ant Design Vue
The defaultTextarea
component does not have a word count function , but this function is very common, so a simple secondary encapsulation was made. In fact, this function is very simple. Without changing the original component, just add a counting text in the lower right corner and use positioning to process it.
Official website address: https://antdv.com/components/input-cn/
The basic usage is as follows:
$attrs
andv-model
can be found in the previous article Analysis of Encapsulation Principles ( https://juejin.cn/post/7003280618473668639#heading-3)
// 文本框// 字数统计 {{ textLength }}/{{ $attrs.maxLength }}
is also very simple to use, just like the normaltextarea
. If you want to enable word count,showWordLimit
andmaxLength
must be configured.
For more programming related knowledge, please visit:Programming Video! !
The above is the detailed content of How to make the Textarea component have 'word count' function in Ant Design Vue. For more information, please follow other related articles on the PHP Chinese website!