mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
fix(button): dynamic bar-button
This commit is contained in:
@ -33,7 +33,7 @@ export class Button {
|
|||||||
* The type of button.
|
* The type of button.
|
||||||
* Possible values are: `"button"`, `"bar-button"`.
|
* Possible values are: `"button"`, `"bar-button"`.
|
||||||
*/
|
*/
|
||||||
@Prop() buttonType = 'button';
|
@Prop({mutable: true}) buttonType = 'button';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The button size.
|
* The button size.
|
||||||
@ -93,6 +93,12 @@ export class Button {
|
|||||||
*/
|
*/
|
||||||
@Event() ionBlur: EventEmitter<BlurEvent>;
|
@Event() ionBlur: EventEmitter<BlurEvent>;
|
||||||
|
|
||||||
|
componentWillLoad() {
|
||||||
|
if (this.el.closest('ion-buttons')) {
|
||||||
|
this.buttonType = 'bar-button';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onFocus() {
|
onFocus() {
|
||||||
this.ionFocus.emit();
|
this.ionFocus.emit();
|
||||||
}
|
}
|
||||||
|
@ -40,13 +40,6 @@ export class Toolbar {
|
|||||||
*/
|
*/
|
||||||
@Prop() translucent = false;
|
@Prop() translucent = false;
|
||||||
|
|
||||||
componentDidLoad() {
|
|
||||||
const buttons = this.el.querySelectorAll('ion-button');
|
|
||||||
for (let i = 0; i < buttons.length; i++) {
|
|
||||||
buttons[i].buttonType = 'bar-button';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hostData() {
|
hostData() {
|
||||||
const themedClasses = this.translucent ? createThemedClasses(this.mode, this.color, 'toolbar-translucent') : {};
|
const themedClasses = this.translucent ? createThemedClasses(this.mode, this.color, 'toolbar-translucent') : {};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user