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.

相关推荐
lzb_kkk15 天前
【实习总结】Qt通过Qt Linguist(语言家)实现多语言支持
开发语言·c++·qt·1024程序员节·qt linguist·qt 语言家
Yangy_Jiaojiao23 天前
三维手眼标定
1024程序员节
guozhetao25 天前
【图论,拓扑排序】P1347 排序
数据结构·c++·python·算法·leetcode·图论·1024程序员节
lzb_kkk1 个月前
【C++】C++四种类型转换操作符详解
开发语言·c++·windows·1024程序员节
lzb_kkk2 个月前
【MFC】编辑框、下拉框、列表控件
c语言·开发语言·c++·mfc·1024程序员节
lzb_kkk2 个月前
【MFC】树控件的使用详解
开发语言·c++·windows·mfc·1024程序员节
SizeTheMoment3 个月前
List介绍
1024程序员节
开利网络3 个月前
产业互联网+三融战略:重构企业增长密码
大数据·运维·服务器·人工智能·重构·1024程序员节
wei_shuo3 个月前
从数据中台到数据飞轮:实现数据驱动的升级之路
1024程序员节·数据飞轮
玖剹4 个月前
矩阵区域和 --- 前缀和
数据结构·c++·算法·leetcode·矩阵·动态规划·1024程序员节