diff --git a/components.js b/components.js
index c61f4d63a..de451cd78 100644
--- a/components.js
+++ b/components.js
@@ -52,4 +52,5 @@ module.exports = [
'radio',
'radio-group',
'datetime-picker',
+ 'number-keyboard',
];
diff --git a/src/number-keyboard/Key.js b/src/number-keyboard/Key.js
index 858af2257..657e4e42c 100644
--- a/src/number-keyboard/Key.js
+++ b/src/number-keyboard/Key.js
@@ -18,6 +18,8 @@ export default createComponent({
loading: Boolean,
},
+ emits: ['press'],
+
data() {
return {
active: false,
@@ -57,7 +59,7 @@ export default createComponent({
genContent() {
const isExtra = this.type === 'extra';
const isDelete = this.type === 'delete';
- const text = this.slots('default') || this.text;
+ const text = this.$slots.default ? this.$slots.default() : this.text;
if (this.loading) {
return ;
diff --git a/src/number-keyboard/README.md b/src/number-keyboard/README.md
index ba612b0e8..57c7bef90 100644
--- a/src/number-keyboard/README.md
+++ b/src/number-keyboard/README.md
@@ -14,7 +14,7 @@ Vue.use(NumberKeyboard);
### Default Keyboard
```html
-
+
Show Keyboard
+
Show IdNumber Keyboard
@@ -83,7 +83,7 @@ Use `extra-key` prop to set the content of bottom left button
Use `title` prop to set keyboard title
```html
-
+
Show Keyboard With Title
+
Show Keyboard With Multiple ExtraKey
+
+
弹出默认键盘
+
弹出身份证号键盘
+
弹出带标题的键盘
+
弹出配置多个按键的键盘
+
-
+
{{ t('button1') }}
-
+
{{ t('button2') }}
-
+
{{ t('button3') }}
-
+
{{ t('button4') }}
-
+
{{ t('button5') }}
(
-
- {key.type === 'delete' && this.slots('delete')}
- {key.type === 'extra' && this.slots('extra-key')}
-
- ));
+ return this.keys.map((key) => {
+ const slots = {};
+
+ if (key.type === 'delete') {
+ slots.default = this.$slots.delete;
+ }
+ if (key.type === 'extra') {
+ slots.default = this.$slots['extra-key'];
+ }
+
+ return (
+
+ );
+ });
},
genSidebar() {
@@ -199,13 +215,12 @@ export default createComponent({