最近在uniapp项目中封装了键盘组件,键盘内部维护的是自己的字符串(增删之后向外发射).
需求: 点击确认时,在外部清空内部字符串的值.
<template>
<view class="password">
<view class="ps_left">
<view style="width: 500rpx;height: 300rpx;">
<uni-easyinput class="psInput" v-model="ps"
placeholder="请输入"
></uni-easyinput>
</view>
<view class="ps_right"><f-keyboard :show="true"
:value="ps" @change="change" @confirm="confirm">
</f-keyboard></view>
</view>
</template>
<script>
import mixin from '@/common/utils/mixin.js'
export default {
data() {
return {
ps: '',
};
},
methods: {
change(res) {
this.ps = res;
},
confirm() {
this.$emit('result', this.ps);
},
}
};
</script>