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;
|
checked?: boolean;
|
||||||
color?: string;
|
color?: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
|
href?: string;
|
||||||
mode?: 'ios' | 'md';
|
mode?: 'ios' | 'md';
|
||||||
value?: string;
|
value?: string;
|
||||||
}
|
}
|
||||||
|
@ -12,12 +12,6 @@ import { getElementClassObject } from '../../utils/theme';
|
|||||||
export class ChipButton {
|
export class ChipButton {
|
||||||
@Element() private el: HTMLElement;
|
@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.
|
* The color to use.
|
||||||
* Default options are: `"primary"`, `"secondary"`, `"danger"`, `"light"`, and `"dark"`.
|
* Default options are: `"primary"`, `"secondary"`, `"danger"`, `"light"`, and `"dark"`.
|
||||||
@ -30,15 +24,21 @@ export class ChipButton {
|
|||||||
*/
|
*/
|
||||||
@Prop() mode: 'ios' | 'md';
|
@Prop() mode: 'ios' | 'md';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true, sets the button into a disabled state.
|
||||||
|
*/
|
||||||
|
@Prop() disabled = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set to `"clear"` for a transparent button style.
|
* Set to `"clear"` for a transparent button style.
|
||||||
*/
|
*/
|
||||||
@Prop() fill: string;
|
@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
|
* Get the classes based on the button type
|
||||||
@ -97,7 +97,10 @@ export class ChipButton {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TagType class={buttonClasses} disabled={this.disabled}>
|
<TagType
|
||||||
|
class={buttonClasses}
|
||||||
|
disabled={this.disabled}
|
||||||
|
href={this.href}>
|
||||||
<span class='button-inner'>
|
<span class='button-inner'>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</span>
|
</span>
|
||||||
|
@ -134,7 +134,11 @@ export class FabButton {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
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>
|
<ion-icon name='close' class='fab-button-close-icon'></ion-icon>
|
||||||
<span class='button-inner'>
|
<span class='button-inner'>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
|
@ -12,7 +12,7 @@ export class InfiniteScrollContent {
|
|||||||
/**
|
/**
|
||||||
* @input {string} An animated SVG spinner that shows while loading.
|
* @input {string} An animated SVG spinner that shows while loading.
|
||||||
*/
|
*/
|
||||||
@Prop({mutable: true}) loadingSpinner: string;
|
@Prop({ mutable: true }) loadingSpinner: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @input {string} Optional text to display while loading.
|
* @input {string} Optional text to display while loading.
|
||||||
|
@ -47,8 +47,14 @@ export class ItemOption {
|
|||||||
render() {
|
render() {
|
||||||
|
|
||||||
const TagType = this.href ? 'a' : 'button';
|
const TagType = this.href ? 'a' : 'button';
|
||||||
|
|
||||||
|
// TODO TagType should wrap button-inner
|
||||||
return [
|
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'>
|
<span class='button-inner'>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</span>
|
</span>
|
||||||
|
@ -11,7 +11,7 @@ export class RefresherContent {
|
|||||||
/**
|
/**
|
||||||
* A static icon to display when you begin to pull down
|
* A static icon to display when you begin to pull down
|
||||||
*/
|
*/
|
||||||
@Prop({mutable: true}) pullingIcon: string;
|
@Prop({ mutable: true }) pullingIcon: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The text you want to display when you begin to pull down
|
* The text you want to display when you begin to pull down
|
||||||
@ -21,7 +21,7 @@ export class RefresherContent {
|
|||||||
/**
|
/**
|
||||||
* An animated SVG spinner that shows when refreshing begins
|
* An animated SVG spinner that shows when refreshing begins
|
||||||
*/
|
*/
|
||||||
@Prop({mutable: true}) refreshingSpinner: string;
|
@Prop({ mutable: true }) refreshingSpinner: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The text you want to display when performing a refresh
|
* The text you want to display when performing a refresh
|
||||||
|
Reference in New Issue
Block a user