uniapp使用easyinput文本框显示输入的字数和限制的字数

uniapp使用easyinput文本框显示输入的字数和限制的字数

先上效果图:

整体代码如下:

<template>
	<view class="nameInfoContent">
		<uni-easyinput class="uni-mt-5" suffixIcon="checkmarkempty" v-model="memberName" placeholder="请输入新昵称"
			maxlength="24" @iconClick="submit" @input="handleInput"></uni-easyinput>
		<view class="wordsNum">
			<view class="tipLips">支持2-24位中英文数字,符号-和_</view>
			<view class="juedui">{{ inputValueLength ? inputValueLength : 0  }}/24 </view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				memberName: '',
				inputValueLength: ''
			}
		},
		methods: {
			handleInput(e) {
				this.inputValueLength = parseInt(e.length);
			}
		}
	}
</script>

<style lang="scss" scoped>
	.nameInfoContent {
		position: relative;
		padding: 32rpx;
		min-height: calc(100vh - 152rpx);

		.wordsNum {
			display: flex;
			justify-content: space-between;
			margin-top: 24rpx;

			.tipLips,
			.juedui {
				font-size: 24rpx;
				color: #999999;
			}
		}
	}
</style>

Live life to the fullest by drawing on your strengths.

相关推荐
✿ ༺ ོIT技术༻4 天前
Linux:TCP和守护进程
linux·运维·服务器·网络·tcp/ip·1024程序员节
辅助东皇燕双鹰8 天前
行测知识()
1024程序员节
深蓝易网11 天前
探寻制造型企业MES管理系统:功能、架构与应用全解析
大数据·运维·人工智能·架构·制造·1024程序员节
Lenyiin16 天前
2848、与车相交的点
c++·算法·leetcode·1024程序员节
earthzhang202122 天前
《深入浅出HTTPS》读书笔记(31):HTTPS和TLS/SSL
开发语言·网络·python·https·1024程序员节
不讲废话的小白24 天前
怎么样把pdf转成图片模式(不能复制文字)
pdf·1024程序员节
明明真系叻25 天前
2025.1.26机器学习笔记:C-RNN-GAN文献阅读
人工智能·笔记·深度学习·机器学习·生成对抗网络·1024程序员节
Joeysoda1 个月前
Java数据结构 (从0构建链表(LinkedList))
java·linux·开发语言·数据结构·windows·链表·1024程序员节
清风-云烟1 个月前
使用redis-cli命令实现redis crud操作
java·linux·数据库·redis·spring·缓存·1024程序员节
Joeysoda1 个月前
Java数据结构 (链表反转(LinkedList----Leetcode206))
java·linux·开发语言·数据结构·链表·1024程序员节