mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 00:42:36 +00:00
Refactor #3922 - For SelectButton
This commit is contained in:
parent
cae74f5c97
commit
515ae35fc5
2 changed files with 27 additions and 2 deletions
|
@ -14,10 +14,10 @@
|
|||
@keydown="onKeydown($event, option, i)"
|
||||
@focus="onFocus($event)"
|
||||
@blur="onBlur($event, option)"
|
||||
v-bind="ptm('button')"
|
||||
v-bind="getPTOptions(option, 'button')"
|
||||
>
|
||||
<slot name="option" :option="option" :index="i">
|
||||
<span class="p-button-label" v-bind="ptm('label')">{{ getOptionLabel(option) }}</span>
|
||||
<span class="p-button-label" v-bind="getPTOptions(option, 'label')">{{ getOptionLabel(option) }}</span>
|
||||
</slot>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -78,6 +78,14 @@ export default {
|
|||
getOptionRenderKey(option) {
|
||||
return this.dataKey ? ObjectUtils.resolveFieldData(option, this.dataKey) : this.getOptionLabel(option);
|
||||
},
|
||||
getPTOptions(option, key) {
|
||||
return this.ptm(key, {
|
||||
context: {
|
||||
active: this.isSelected(option),
|
||||
disabled: this.isOptionDisabled(option)
|
||||
}
|
||||
});
|
||||
},
|
||||
isOptionDisabled(option) {
|
||||
return this.optionDisabled ? ObjectUtils.resolveFieldData(option, this.optionDisabled) : false;
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue