mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
fix(button): update button components to pass down href
This commit is contained in:
1
packages/core/src/components.d.ts
vendored
1
packages/core/src/components.d.ts
vendored
@ -2470,6 +2470,7 @@ declare global {
|
||||
checked?: boolean;
|
||||
color?: string;
|
||||
disabled?: boolean;
|
||||
href?: string;
|
||||
mode?: 'ios' | 'md';
|
||||
value?: string;
|
||||
}
|
||||
|
@ -12,12 +12,6 @@ import { getElementClassObject } from '../../utils/theme';
|
||||
export class ChipButton {
|
||||
@Element() private el: HTMLElement;
|
||||
|
||||
/**
|
||||
* Contains a URL or a URL fragment that the hyperlink points to.
|
||||
* If this property is set, an anchor tag will be rendered.
|
||||
*/
|
||||
@Prop() href: string;
|
||||
|
||||
/**
|
||||
* The color to use.
|
||||
* Default options are: `"primary"`, `"secondary"`, `"danger"`, `"light"`, and `"dark"`.
|
||||
@ -30,15 +24,21 @@ export class ChipButton {
|
||||
*/
|
||||
@Prop() mode: 'ios' | 'md';
|
||||
|
||||
/**
|
||||
* If true, sets the button into a disabled state.
|
||||
*/
|
||||
@Prop() disabled = false;
|
||||
|
||||
/**
|
||||
* Set to `"clear"` for a transparent button style.
|
||||
*/
|
||||
@Prop() fill: string;
|
||||
|
||||
/**
|
||||
* If true, sets the button into a disabled state.
|
||||
* Contains a URL or a URL fragment that the hyperlink points to.
|
||||
* If this property is set, an anchor tag will be rendered.
|
||||
*/
|
||||
@Prop() disabled = false;
|
||||
@Prop() href: string;
|
||||
|
||||
/**
|
||||
* Get the classes based on the button type
|
||||
@ -97,7 +97,10 @@ export class ChipButton {
|
||||
};
|
||||
|
||||
return (
|
||||
<TagType class={buttonClasses} disabled={this.disabled}>
|
||||
<TagType
|
||||
class={buttonClasses}
|
||||
disabled={this.disabled}
|
||||
href={this.href}>
|
||||
<span class='button-inner'>
|
||||
<slot></slot>
|
||||
</span>
|
||||
|
@ -134,7 +134,11 @@ export class FabButton {
|
||||
};
|
||||
|
||||
return (
|
||||
<TagType class={fabClasses} onClick={this.clickedFab.bind(this)} disabled={this.disabled}>
|
||||
<TagType
|
||||
class={fabClasses}
|
||||
disabled={this.disabled}
|
||||
href={this.href}
|
||||
onClick={this.clickedFab.bind(this)}>
|
||||
<ion-icon name='close' class='fab-button-close-icon'></ion-icon>
|
||||
<span class='button-inner'>
|
||||
<slot></slot>
|
||||
|
@ -47,8 +47,14 @@ export class ItemOption {
|
||||
render() {
|
||||
|
||||
const TagType = this.href ? 'a' : 'button';
|
||||
|
||||
// TODO TagType should wrap button-inner
|
||||
return [
|
||||
<TagType class='item-option-button' onClick={this.clickedOptionButton.bind(this)} disabled={this.disabled}></TagType>,
|
||||
<TagType
|
||||
class='item-option-button'
|
||||
disabled={this.disabled}
|
||||
href={this.href}
|
||||
onClick={this.clickedOptionButton.bind(this)}></TagType>,
|
||||
<span class='button-inner'>
|
||||
<slot></slot>
|
||||
</span>
|
||||
|
Reference in New Issue
Block a user