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.

相关推荐
SizeTheMoment16 天前
List介绍
1024程序员节
开利网络18 天前
产业互联网+三融战略:重构企业增长密码
大数据·运维·服务器·人工智能·重构·1024程序员节
wei_shuo25 天前
从数据中台到数据飞轮:实现数据驱动的升级之路
1024程序员节·数据飞轮
玖剹1 个月前
矩阵区域和 --- 前缀和
数据结构·c++·算法·leetcode·矩阵·动态规划·1024程序员节
jamison_12 个月前
文心一言与 DeepSeek 的竞争分析:技术先发优势为何未能转化为市场主导地位?
人工智能·ai·chatgpt·gpt-3·1024程序员节
NaZiMeKiY2 个月前
HTML5前端第六章节
前端·html·html5·1024程序员节
jamison_12 个月前
颠覆未来:解锁ChatGPT衍生应用的无限可能(具体应用、功能、付费模式与使用情况)
ai·chatgpt·1024程序员节
NaZiMeKiY3 个月前
HTML5前端第七章节
1024程序员节
earthzhang20213 个月前
《Python深度学习》第四讲:计算机视觉中的深度学习
人工智能·python·深度学习·算法·计算机视觉·numpy·1024程序员节
明明真系叻3 个月前
2025.3.2机器学习笔记:PINN文献阅读
人工智能·笔记·深度学习·机器学习·1024程序员节·pinn