mirror of https://github.com/ElemeFE/element
Button: avoid click event bubbling when disabled
parent
dc77b56d31
commit
e289e86154
|
@ -13,9 +13,9 @@
|
|||
}
|
||||
]"
|
||||
>
|
||||
<i class="el-icon-loading" v-if="loading"></i>
|
||||
<i :class="'el-icon-' + icon" v-if="icon && !loading"></i>
|
||||
<span v-if="$slots.default"><slot></slot></span>
|
||||
<i class="el-icon-loading" v-if="loading" @click="handleInnerClick"></i>
|
||||
<i :class="'el-icon-' + icon" v-if="icon && !loading" @click="handleInnerClick"></i>
|
||||
<span v-if="$slots.default" @click="handleInnerClick"><slot></slot></span>
|
||||
</button>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -45,6 +45,11 @@
|
|||
methods: {
|
||||
handleClick(evt) {
|
||||
this.$emit('click', evt);
|
||||
},
|
||||
handleInnerClick(evt) {
|
||||
if (this.disabled) {
|
||||
evt.stopPropagation();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue