更新记录
0.0.2(2023-05-11) 下载此版本
1.修复在VUE3下报错问题 2.增加 onSetText、方法 3.增加input、confirm事件
0.0.1(2022-03-22) 下载此版本
首次发布
平台兼容性
uni-app
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | √ | - | - | √ | × | - | - | - |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
× | × | × | × | - | - | - | × | - | × | × |
示例
<template>
<view class="content">
<view>
<tk-input ref="myInput1" class="un-input" :allowEdit="true"
:style="{border:'1px solid #000', margin: '5px'}" @input="input" v-model="value1"
@confirm="onInput1Confirm" />
<view>value1:{{value1}}</view>
<tk-input ref="myInput2" v-model="value2" class="un-input" :style="{border:'1px solid #000', margin: '5px'}"
@input="input" @confirm="onInput2Confirm" />
<view>value2:{{value2}}</view>
</view>
<button @click="focus">input1获得焦点</button>
<button @click="showKeyboard">input1显示键盘</button>
<button @click="hideKeyboard">input1隐藏键盘</button>
<button @click="onSetText">input1 onSetText</button>
<button @click="">input1 </button>
<button @click="focus1">input2获得焦点1</button>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello',
value1: "",
value2: ''
}
},
onLoad() {
this.$nextTick(() => {
this.$refs.myInput1.focus()
})
},
methods: {
input(e) {
console.log("e ************: ", e);
},
focus() {
this.$refs.myInput1.focus()
},
focus1() {
this.$refs.myInput2.focus()
},
showKeyboard() {
this.$refs.myInput1.showKeyboard()
},
hideKeyboard() {
this.$refs.myInput1.hideKeyboard()
},
onInput1Confirm(val) {
console.log("val ************: ", val);
this.$refs.myInput1.focus()
},
onInput2Confirm(val) {
console.log("val ************: ", val);
this.$refs.myInput1.focus()
},
onSetText() {
this.$refs.myInput1.onSetText('99999');
},
() {
this.$refs.myInput1.onReset();
}
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
</style>