mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 02:31:21 +00:00
[new feature] NumberKeyboard: add delete slot (#3499)
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user