Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 重构 RareWordsKeyboard #1067

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading