👉使用方法,跟数1,2,3一样简单


基本示例

<tm-password v-model="num" :code-length="4" ></tm-password>
1
<script>
	export default {
		data() {
			return {
				num:''
			}
		},
		methods: {}
	}
</script>

1
2
3
4
5
6
7
8
9
10
11

👉外框形状


主要通过控制model=[line|box|fill]类型

<tm-password  model="line"></tm-password>
1

👉内部形状


主要通过控制noval=[mline|round]类型

<tm-password  noval="round"></tm-password>
1

👉完整的示例


以下可以复制直接运行哦。不同的外框类型注意高亮部分

<template>
	<tm-fullView>
		<template v-slot:default="{info}">
			<view class="grey text " :class="$tm.vx.state().tmVuetify.black?'black bk':''" :style="{minHeight:info.height+'px'}">
				<tm-menubars title="密码输入框" color="bg-gradient-primary-lighten"  :showback="true"></tm-menubars>
				<tm-sheet :shadow="24">
					<view class="text-size-s text-weight-b mb-24">验证码</view>
					<tm-password  v-model="num" :code-length="4" :show-val="true" noval="round"></tm-password>
				</tm-sheet>
				
				<tm-sheet :shadow="24">
					<view class="text-size-s text-weight-b mb-24">个性化</view>
					<tm-password :round="24" :shadow="16" bg-color="white" text-color='primary' :height='110' :width='110' v-model="num" :code-length="4" :show-val="true" noval="mline"></tm-password>
					
				</tm-sheet>
				<tm-sheet :shadow="25">
					<view class="text-size-s text-weight-b mb-24">换个形状</view>
					<tm-password v-model="num" :code-length="5" :show-val="false" noval="mline"></tm-password>
					<view class="py-12"></view>
					<tm-password v-model="num" :code-length="5" :show-val="true" noval="round" model="line"></tm-password>
					<view class="py-32"></view>
					<tm-password v-model="num" :code-length="5" :show-val="false" noval="round" model="box"></tm-password>
					
				</tm-sheet>
				<tm-sheet >
					<view class="text-size-s text-weight-b mb-24 mt-24">暗黑模式</view>
					<tm-password v-model="num" :code-length="5" :black="true" :show-val="true" noval="round" model="box"></tm-password>
				</tm-sheet>
				<view style="height: 50upx;"></view>
			</view>
		</template>
	</tm-fullView>

</template>





 




 

 



 
 

 














1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<script>
	export default {
		data() {
			return {
				num:''
			}
		},
		methods: {
			
		}
	}
</script>

1
2
3
4
5
6
7
8
9
10
11
12
13

👉启用暗黑模式


只要:black="true"即可啦

<!-- 完整的示例见上方 -->
<tm-sheet>
	<tm-password :black="true"></tm-password>
</tm-sheet>


 

1
2
3
4

👉props属性表

属性名称类型可选值默认值说明
valueStringNumber任意文本''
blackBooleantrue/falsefalse暗黑模式
colorString任意主题色名primary主题色
bg-colorString任意主题色名grey-lighten-4输入框的背景色
code-lengthNumber任意数字4验证码长度
show-valBooleantrue/falsefalse是否展现/隐藏输入内容
text-colorString任意主题色名primary文字颜色
keyborad-modelStringnumber/passwordnumber键盘类型
modelStringline/box/fillfill外框的样式
novalStringmline/roundround中间填充数据的样式
roundNumber任意数字4圆角
widthNumber任意数字0项目的宽,默认使用百分比的宽度
heightNumber任意数字100项目的高
shadowNumber任意数字0投影

外框的样式model的可选值含意

lineboxfill
线型边框型背景色型

中间填充数据的样式noval的可选值含意

mlineround
中间为线型中间为圆点型

👉事件

事件名称返回参数返参类型说明
@confirminputString键盘上点击确认键触发,并携带该键盘输入的数据,同v-model数据一致

示例如下

<tm-password 
@confirm="confirm"  
v-model="word"></tm-password>

 

1
2
3
<script>
	export default {
		data() {
			return {
				word:'',
			}
		},
		methods: {
			confirm(val){
				console.log(`我是输入的数据:${val}`);
			}
		}
	}
</script>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

👉更新日志

2021年8月20日14:8:5 初始版本。

tmzdy 于 2022/12/7 编辑 报错? | 评论?