Skip to content

Commit

Permalink
feat: 重构 RareWordsKeyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamondYuan committed Jan 29, 2024
1 parent f418779 commit 049ef0e
Show file tree
Hide file tree
Showing 36 changed files with 1,694 additions and 357 deletions.
41 changes: 20 additions & 21 deletions compiled/alipay/demo/pages/RareWordsKeyboard/index.axml
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
<list header="基础使用">
<container title="姓名">
<input placeholder="请输入姓名" value="{{ value }}" onChange="onInputChange">
<view slot="suffix" class="tips" onTap="onTap">生僻字?</view>
</input>
<ant-input
placeholder="请输入姓名"
value="{{ value }}"
onChange="onInputChange">
<view
slot="suffix"
class="tips"
onTap="onTap">
生僻字?
</view>
</ant-input>
</container>

<list-item onTap="onTap">
默认键盘
</list-item>
<list-item onTap="onTap">默认键盘</list-item>

<rare-words-keyboard
visible="{{visible}}"
visible="{{ visible }}"
onClose="onClose"
onChange="onChange"
/>
onChange="onChange" />

<list-item onTap="onTap2">
不带蒙层
</list-item>
<list-item onTap="onTap2">不带蒙层</list-item>

<rare-words-keyboard
visible="{{visible2}}"
visible="{{ visible2 }}"
showMask="{{ false }}"
onClose="onClose2"
onChange="onChange"
/>
onChange="onChange" />

<list-item onTap="onTap3">
监听输入完成、出错的回调
</list-item>
<list-item onTap="onTap3">监听输入完成、出错的回调</list-item>

<rare-words-keyboard
visible="{{visible3}}"
visible="{{ visible3 }}"
onClose="onClose3"
onChange="onChange"
onError="onKeyBoardError"
/>
onError="onKeyBoardError" />
</list>
76 changes: 38 additions & 38 deletions compiled/alipay/demo/pages/RareWordsKeyboard/index.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
Page({
data: {
value: '',
visible: false,
visible2: false,
visible3: false,
},
onInputChange(value) {
this.setData({ value });
},
// 默认键盘
onTap() {
this.setData({ visible: true });
},
// 关闭键盘
onClose() {
this.setData({ visible: false });
},
// 不带蒙层
onTap2() {
this.setData({ visible2: true });
},
onClose2() {
this.setData({ visible2: false });
},
// 监听各种事件
onTap3() {
this.setData({ visible3: true });
},
onClose3() {
this.setData({ visible3: false });
},
onChange(value) {
const curValue = this.data.value;
this.setData({ value: curValue + value });
},
onKeyBoardError(err) {
my.showToast({ content: 'onError ' + err.toString() });
}
data: {
value: '',
visible: false,
visible2: false,
visible3: false,
},
onInputChange(value) {
this.setData({ value });
},
// 默认键盘
onTap() {
this.setData({ visible: true });
},
// 关闭键盘
onClose() {
this.setData({ visible: false });
},
// 不带蒙层
onTap2() {
this.setData({ visible2: true });
},
onClose2() {
this.setData({ visible2: false });
},
// 监听各种事件
onTap3() {
this.setData({ visible3: true });
},
onClose3() {
this.setData({ visible3: false });
},
onChange(value) {
const curValue = this.data.value;
this.setData({ value: curValue + value });
},
onKeyBoardError(err) {
my.showToast({ content: 'onError ' + err.toString() });
},
});
2 changes: 1 addition & 1 deletion compiled/alipay/demo/pages/RareWordsKeyboard/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"list": "../../../src/List/index",
"list-item": "../../../src/List/ListItem/index",
"icon": "../../../src/Icon/index",
"input": "../../../src/Input/index",
"ant-input": "../../../src/Input/index",
"container": "../../../src/Container/index"
}
}
2 changes: 1 addition & 1 deletion compiled/alipay/src/RareWordsKeyboard/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<view
a:if="{{ visible }}"
class="ant-rare-words-keyboard-modal {{ showMask ? '' : 'hide' }}"
onTap="onHide"
onTap="handleHide"
onAppear="catchAppearModal" />
<view class="ant-rare-words-keyboard-kb {{ visible ? '' : 'hide' }}">
<view class="ant-rare-words-keyboard-header">
Expand Down
Loading

0 comments on commit 049ef0e

Please sign in to comment.