Skip to content

Commit

Permalink
Refactor #3965 - For Button
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Jun 23, 2023
1 parent c25c24a commit 810894d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion components/lib/button/Button.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<button v-ripple :class="cx('root')" type="button" :aria-label="defaultAriaLabel" :disabled="disabled" v-bind="ptm('root', { disabled })" data-pc-name="button" :data-pc-severity="severity">
<button v-ripple :class="cx('root')" type="button" :aria-label="defaultAriaLabel" :disabled="disabled" v-bind="getPTOptions('root')" data-pc-name="button" :data-pc-severity="severity">
<slot>
<slot v-if="loading" name="loadingicon" :class="[cx('loadingIcon'), cx('icon')]">
<span v-if="loadingIcon" :class="[cx('loadingIcon'), cx('icon'), loadingIcon]" v-bind="ptm('loadingIcon')" />
Expand All @@ -22,6 +22,15 @@ import BaseButton from './BaseButton.vue';
export default {
name: 'Button',
extends: BaseButton,
methods: {
getPTOptions(key) {
return this.ptm(key, {
context: {
disabled: this.disabled
}
});
}
},
computed: {
disabled() {
return this.$attrs.disabled || this.$attrs.disabled === '' || this.loading;
Expand Down

0 comments on commit 810894d

Please sign in to comment.