feat(SidebarItem): add disabled prop (#4325)

This commit is contained in:
neverland
2019-09-02 19:44:14 +08:00
committed by GitHub
parent 52f3de8cf8
commit 329e751351
8 changed files with 144 additions and 73 deletions
+7 -2
View File
@@ -12,7 +12,8 @@ export default createComponent({
props: {
...routeProps,
info: [Number, String],
title: String
title: String,
disabled: Boolean
},
computed: {
@@ -23,6 +24,10 @@ export default createComponent({
methods: {
onClick() {
if (this.disabled) {
return;
}
this.$emit('click', this.index);
this.parent.$emit('input', this.index);
this.parent.$emit('change', this.index);
@@ -33,7 +38,7 @@ export default createComponent({
render() {
return (
<a
class={[bem({ select: this.select }), BORDER]}
class={[bem({ select: this.select, disabled: this.disabled }), BORDER]}
onClick={this.onClick}
>
<div class={bem('text')}>
+8
View File
@@ -40,4 +40,12 @@
background-color: @sidebar-selected-background-color;
}
}
&--disabled {
color: @sidebar-disabled-text-color;
&:active {
background-color: @sidebar-background-color;
}
}
}