[new feature] NumberKeyboard: add delete slot (#3499)

This commit is contained in:
neverland
2019-06-13 19:23:51 +08:00
committed by GitHub
parent 639450709f
commit efa2e0c5d7
7 changed files with 149 additions and 62 deletions

View File

@@ -4,7 +4,8 @@ const [sfc, bem] = use('key');
export default sfc({
props: {
type: Array,
type: String,
theme: Array,
text: [String, Number]
},
@@ -16,9 +17,17 @@ export default sfc({
computed: {
className() {
const types = this.type.slice(0);
this.active && types.push('active');
return bem(types);
const classNames = this.theme.slice(0);
if (this.active) {
classNames.push('active');
}
if (this.type) {
classNames.push(this.type);
}
return bem(classNames);
}
},
@@ -32,7 +41,7 @@ export default sfc({
},
onClick() {
this.$emit('press', this.text);
this.$emit('press', this.text, this.type);
}
},
@@ -49,7 +58,7 @@ export default sfc({
onTouchend={onBlur}
onTouchcancel={onBlur}
>
{this.text}
{this.slots('default') || this.text}
</i>
);
}