Home> Web Front-end> Vue.js> body text

How to make the Textarea component have 'word count' function in Ant Design Vue

青灯夜游
Release: 2021-12-21 10:47:43
forward
5345 people have browsed it

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!

How to make the Textarea component have 'word count' function in Ant Design Vue

Recommend a practical "word count" function:Ant Design VueThe defaultTextareacomponent 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.

Default textarea

Official website address: https://antdv.com/components/input-cn/

The basic usage is as follows:

Copy after login

How to make the Textarea component have word count function in Ant Design Vue

The implemented principles of the transformed textarea

$attrsandv-modelcan be found in the previous article Analysis of Encapsulation Principles ( https://juejin.cn/post/7003280618473668639#heading-3)

  
Copy after login

is also very simple to use, just like the normaltextarea. If you want to enable word count,showWordLimitandmaxLengthmust be configured.

Copy after login

How to make the Textarea component have word count function in Ant Design Vue

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!

Related labels:
source:juejin.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!