feat(NumberKeyboard): use delete icon instead of delete text (#6151)

This commit is contained in:
neverland
2020-04-27 19:14:44 +08:00
committed by GitHub
parent 3360ca7eb0
commit 9e7d72eff2
10 changed files with 464 additions and 431 deletions
+13 -1
View File
@@ -1,5 +1,6 @@
import { createNamespace } from '../utils';
import { TouchMixin } from '../mixins/touch';
import DeleteIcon from './DeleteIcon';
const [createComponent, bem] = createNamespace('key');
@@ -47,6 +48,17 @@ export default createComponent({
this.$emit('press', this.text, this.type);
}
},
genContent() {
const isDelete = this.type === 'delete';
const text = this.slots('default') || this.text;
if (isDelete) {
return text || <DeleteIcon class={bem('delete-icon')} />;
}
return text;
},
},
render() {
@@ -64,7 +76,7 @@ export default createComponent({
},
])}
>
{this.slots('default') || this.text}
{this.genContent()}
</div>
</div>
);