Skip to content
On this page

组件库文档 tmui.design

键盘 keyboard

键盘组件提供四种模式,可以适应多种输入环境,分别为密码输入,身份证号输入,车牌输入以及常见的数字键盘

因这个组件名字拼错了,现在为了纠正:keyboard和keyborad,两个组件同时存在,可以共用。到了年底错误的组件将删除,请大家做好使用正确组件。


🌶️ 键盘 Keyborad 示例

查看模拟效果
示例模板
vue
<template>
	<tm-app>
		<tm-sheet>
			<tm-text :font-size="24" _class="font-weight-b" label="基础示例,更多见文档"></tm-text>
			<tm-divider></tm-divider>
			<tm-radio-group v-model="modeltype">
				<tm-radio value="password" label="密码"></tm-radio>
				<tm-radio value="card" color="red" label="身份证"></tm-radio>
				<tm-radio value="car" color="blue" label="车牌"></tm-radio>
				<tm-radio value="number" color="green" label="数字键盘"></tm-radio>
			</tm-radio-group>

		</tm-sheet>
		
		<tm-cell @click="showdate=true" title="弹出键盘" rightColor="primary" :right-text="dateStr"></tm-cell>
		<tm-keyboard decimal :type="modeltype" v-model="dateStr" v-model:show="showdate"></tm-keyboard>

	</tm-app>
</template>
<script lang="ts" setup>
import { ref, computed,watch } from "vue"
import { onShow, onLoad } from "@dcloudio/uni-app";
import tmApp from "@/tmui/components/tm-app/tm-app.vue"
import tmSheet from "@/tmui/components/tm-sheet/tm-sheet.vue"
import tmText from "@/tmui/components/tm-text/tm-text.vue"
import tmRadio from "@/tmui/components/tm-radio/tm-radio.vue"
import tmRadioGroup from "@/tmui/components/tm-radio-group/tm-radio-group.vue"
import tmDivider from "@/tmui/components/tm-divider/tm-divider.vue"
import tmCell from "@/tmui/components/tm-cell/tm-cell.vue"
import tmKeyboard from "@/tmui/components/tm-keyboard/tm-keyboard.vue"
const modeltype = ref('password')
const dateStr = ref('')
const showdate = ref(false)


</script>

🌶️ 兼容性

APP-VUEAPP-NVUE小程序WEB/H5VUE3/TS
✔️✔️✔️✔️✔️

🌱 参数

本组件含有公共属性 公共属性

参数名类型默认值描述
typeStringnumber可选:card 身份证,car 车牌,password 密码,number 数字
showBooleanfalse是否显示
modelValueString""输入值v-model
defaultValueString""默认内容
colorStringprimary键盘颜色
randomBooleanfalse是否为随机键盘
decimalBooleantrue是否显示小数点(数字键盘有效)

🌹 事件

事件名参数返回数据描述
change-modelValue返回当前输入内容
confirm-modelValue返回最终输入内容,并隐藏键盘

🌽 slot插槽

🥗 ref方法

😡 贡献者

Wicos