更新记录

0.0.2(2023-05-11)

1.修复在VUE3下报错问题 2.增加 onSetText、方法 3.增加input、confirm事件

0.0.1(2022-03-22)

首次发布


平台兼容性

Vue2 Vue3
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
HBuilderX 3.7.11 app-vue × × × × × ×
钉钉小程序 快手小程序 飞书小程序 京东小程序
× × × ×
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari
× × × × × × × × ×

示例

<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.();
            }
        }
    }
</script>

<style>
    .content {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
</style>

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问