Refactor #3965 - For Button

pull/4084/head
Tuğçe Küçükoğlu 2023-06-23 12:53:53 +03:00
parent c25c24a1d4
commit 810894df5a
1 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,5 @@
<template> <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>
<slot v-if="loading" name="loadingicon" :class="[cx('loadingIcon'), cx('icon')]"> <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')" /> <span v-if="loadingIcon" :class="[cx('loadingIcon'), cx('icon'), loadingIcon]" v-bind="ptm('loadingIcon')" />
@ -22,6 +22,15 @@ import BaseButton from './BaseButton.vue';
export default { export default {
name: 'Button', name: 'Button',
extends: BaseButton, extends: BaseButton,
methods: {
getPTOptions(key) {
return this.ptm(key, {
context: {
disabled: this.disabled
}
});
}
},
computed: { computed: {
disabled() { disabled() {
return this.$attrs.disabled || this.$attrs.disabled === '' || this.loading; return this.$attrs.disabled || this.$attrs.disabled === '' || this.loading;