frontend/examking-app/plugins/uview-ui/components/u-message-input/u-message-input.vue

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<template>
	<view class="u-char-box">
		<view class="u-char-flex">
			<input :disabled="disabledKeyboard" :value="valueModel" type="number" :focus="focus" :maxlength="maxlength" class="u-input" @input="getVal"/>
			<view v-for="(item, index) in loopCharArr" :key="index">
				<view :class="[breathe && charArrLength == index ? 'u-breathe' : '', 'u-char-item',
				charArrLength === index && mode == 'box' ? 'u-box-active' : '',
				mode === 'box' ? 'u-box' : '']" :style="{
					fontWeight: bold ? 'bold' : 'normal',
					fontSize: fontSize + 'rpx',
					width: width + 'rpx',
					height: width + 'rpx',
					color: inactiveColor,
					borderColor: charArrLength === index && mode == 'box' ? activeColor : inactiveColor
				}">
					<view class="u-placeholder-line" :style="{
							display: charArrLength === index ? 'block' : 'none',
							height: width * 0.5 +'rpx'
						}"
						v-if="mode !== 'middleLine'"
					></view>
					<view v-if="mode === 'middleLine' && charArrLength <= index" :class="[breathe && charArrLength == index ? 'u-breathe' : '', charArrLength === index ? 'u-middle-line-active' : '']"
					 class="u-middle-line" :style="{height: bold ? '4px' : '2px', background: charArrLength === index ? activeColor : inactiveColor}"></view>
					<view v-if="mode === 'bottomLine'" :class="[breathe && charArrLength == index ? 'u-breathe' : '', charArrLength === index ? 'u-buttom-line-active' : '']"
					 class="u-bottom-line" :style="{height: bold ? '4px' : '2px', background: charArrLength === index ? activeColor : inactiveColor}"></view>
					<block v-if="!dotFill"> {{ charArr[index] ? charArr[index] : ''}}</block>
					<block v-else>
						<text class="u-dot">{{ charArr[index] ? '●' : ''}}</text>
					</block>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	/**
	 * messageInput 验证码输入框
	 * @description 该组件一般用于验证用户短信验证码的场景,也可以结合uView的键盘组件使用
	 * @tutorial https://www.uviewui.com/components/messageInput.html
	 * @property {String Number} maxlength 输入字符个数(默认4)
	 * @property {Boolean} dot-fill 是否用圆点填充(默认false)
	 * @property {String} mode 模式选择,见上方"基本使用"说明(默认box)
	 * @property {String Number} value 预置值
	 * @property {Boolean} breathe 是否开启呼吸效果,见上方说明(默认true)
	 * @property {Boolean} focus 是否自动获取焦点(默认false)
	 * @property {Boolean} bold 字体和输入横线是否加粗(默认true)
	 * @property {String Number} font-size 字体大小,单位rpx(默认60)
	 * @property {String} active-color 当前激活输入框的样式(默认#2979ff)
	 * @property {String} inactive-color 非激活输入框的样式,文字颜色同此值(默认#606266)
	 * @property {String | Number} width 输入框宽度,单位rpx,高等于宽(默认80)
	 * @property {Boolean} disabled-keyboard 禁止点击输入框唤起系统键盘(默认false)
	 * @event {Function} change 输入内容发生改变时触发,具体见官网说明
	 * @event {Function} finish 输入字符个数达maxlength值时触发,见官网说明
	 * @example <u-message-input mode="bottomLine"></u-message-input>
	 */
	export default {
		name: "u-message-input",
		props: {
			// 最大输入长度
后面还有 251 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。