Regarding the bug that the input word count of the textarea component of the WeChat applet > limit the number of words

Bug formation conditions: As shown in the figure below, when you need to add a function of counting the number of input words to the textarea component, if the maximum number of words is reached by copying and pasting on the mobile phone, continue to use the small keyboard on the mobile phone to enter content at this time, and the input will appear The bug that the word count is greater than the limit, and the extra word count is the length of the content currently entered on your keypad .

 Solution: Assuming that the variable bound to textarea is value, you need to compare the length of value with the maximum limit length after each acquisition. If the length of value is less than the limit length, the length of value will be displayed. If the length of value is greater than the limit length, Then take the limited length display

Guess you like

Origin blog.csdn.net/qq_35408366/article/details/128446528
Recommended