当前位置:网站首页>[wechat applet] text field input with maximum word limit (1/100)
[wechat applet] text field input with maximum word limit (1/100)
2022-07-21 02:53:00 【Chang'an CC】
<!-- Input box -->
<view class="inputBox">
<textarea class="textarea2" auto-height minlength="{
{minAddr}}" maxlength="{
{maxAddr}}" placeholder=" Please enter the mailing address " placeholder-class="phcolor" bindinput="inputeditAddr" data-obj="contentAddr" value="{
{contentAddr}}">
<text class="currentWordNumber">{
{currentWordNumberAddr|0}}/{
{maxAddr}}</text>
</textarea>
</view>
// Text domain
minAddr: 0,
maxAddr: 100,
contentAddr: '', // Mailing address
// inputeditAddr
inputeditAddr(e) {
var value = e.detail.value;
let dataset = e.currentTarget.dataset;
this.data[dataset.obj] = value;
var len = parseInt(value.length);
if (len > this.data.maxAddr) return;
this.setData({
currentWordNumberAddr: len
});
if (this.data.currentWordNumberAddr == 100) {
wx.showModal({
title: ' Tips ',
content: ' You have entered the maximum number of times ',
})
}
},
/* */
.inputBox {
width: 100%;
/* height: 76rpx; */
display: flex;
box-sizing: border-box;
/* padding: 0 20rpx; */
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
}
.textarea2 {
width: 100%;
min-height: 200rpx;
max-height: 400rpx;
line-height: 40rpx;
background-color: #f6f6f6;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 400;
/* padding: 20rpx 0; */
padding: 20rpx;
box-sizing: border-box;
/* line-height: 60rpx; */
color: #2B2B36;
position: relative;
}
.currentWordNumber {
position: absolute;
bottom: 24rpx;
right: 26rpx;
color: #888;
}
边栏推荐
- [resolved] org apache. catalina. Lifecycleexception: failed to start component [standardengine[catalina] StandardHost[localhost]
- Virtual reality coexists, building a digital intelligence life | HMS core Sparkle application innovation sub forum registration launch
- STL vector的操作
- cnvd_ 2019_ twenty-two thousand two hundred and thirty-eight
- Check whether the date is between the other two dates
- How to delete different text in Excel spreadsheet in batch?
- [1000 cases of ArcGIS micro courses] 0029: ArcGIS drawing parallel lines (constructing parallel roads)
- [Android Development iOS Series] Language: SWIFT vs kotlin
- gerrit系统如何配置访问控制
- Difi: a go as you pay Wi Fi access system intensive reading notes (II)
猜你喜欢
【微信小程序】文本域输入带最大字数限制(1/100)
不掌握这些坑,你敢用BigDecimal吗?
[Android开发学iOS系列] 语言篇: Swift vs Kotlin
Construction and practice of full stack code test coverage and use case discovery system
HMS core graphics and image technology shows the latest functions and application scenarios, and accelerates the construction of digital intelligence life
From concept to security practice: a basic guide to software supply chain
An interesting example to illustrate the difference of emplace_ back() and push_ back()
What is integer lifting (instance)
PPT柱状图如何增加柱子
How does HMS core security detection service help freshmen prevent Telecom fraud?
随机推荐
vivo官网APP全机型UI适配方案
【 微信小程序请求封装】【进阶版】处理401请求token过期--重新登录--重新发起刚才过期的请求
Cadisplaylink, nstimer circular reference solution
MongoDB数据库简介、安装和基本使用
电路板调试
What is the registration process of website domain name?
With high concurrency, ratelimiter and semaphore are used to limit the flow of access resources
密码密钥硬编码检查
How does excel choose specific numbers to sum? Excel method of selecting specific numbers for summation
[Android開發學iOS系列] 語言篇: Swift vs Kotlin
Returns the quarter and year of the date provided
Baidu flying paste application running on embedded ARM
开发者必读:2022年移动应用运营增长洞察白皮书
【FAQ】接入HMS Core推送服务,服务端下发消息常见错误码原因分析及解决方法
Alibaba cloud international account registration FAQ summary
Practice of online problem feedback module (VIII): realize image upload function (Part 1)
Densenet learning notes (core vs. RESNET):
How to enable excel macros when they are disabled? The solution of Excel unable to enable macros
cnvd_ 2019_ twenty-two thousand two hundred and thirty-eight
CADisplayLink、NSTimer循环引用解决方案