mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 21:15:24 +08:00
fix(item): add disabled property and styles
This commit is contained in:
1
packages/core/src/components.d.ts
vendored
1
packages/core/src/components.d.ts
vendored
@ -1438,6 +1438,7 @@ declare global {
|
|||||||
namespace JSXElements {
|
namespace JSXElements {
|
||||||
export interface IonItemAttributes extends HTMLAttributes {
|
export interface IonItemAttributes extends HTMLAttributes {
|
||||||
color?: string;
|
color?: string;
|
||||||
|
disabled?: boolean;
|
||||||
href?: string;
|
href?: string;
|
||||||
mode?: 'ios' | 'md';
|
mode?: 'ios' | 'md';
|
||||||
onclick?: (this: HTMLElement, ev: MouseEvent) => any;
|
onclick?: (this: HTMLElement, ev: MouseEvent) => any;
|
||||||
|
@ -105,3 +105,9 @@ ion-input.item {
|
|||||||
.item .button {
|
.item .button {
|
||||||
@include margin(0);
|
@include margin(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.item-disabled {
|
||||||
|
cursor: default;
|
||||||
|
opacity: .4;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
@ -31,6 +31,11 @@ export class Item {
|
|||||||
*/
|
*/
|
||||||
@Prop() mode: 'ios' | 'md';
|
@Prop() mode: 'ios' | 'md';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true, the user cannot interact with the item. Defaults to `false`.
|
||||||
|
*/
|
||||||
|
@Prop() disabled = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains a URL or a URL fragment that the hyperlink points to.
|
* Contains a URL or a URL fragment that the hyperlink points to.
|
||||||
* If this property is set, an anchor tag will be rendered.
|
* If this property is set, an anchor tag will be rendered.
|
||||||
@ -95,7 +100,8 @@ export class Item {
|
|||||||
...childStyles,
|
...childStyles,
|
||||||
...createThemedClasses(this.mode, this.color, 'item'),
|
...createThemedClasses(this.mode, this.color, 'item'),
|
||||||
...getElementClassMap(this.el.classList),
|
...getElementClassMap(this.el.classList),
|
||||||
'item-block': true
|
'item-block': true,
|
||||||
|
'item-disabled': this.disabled,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.hasStyleChange = false;
|
this.hasStyleChange = false;
|
||||||
|
@ -16,6 +16,13 @@ Default options are: `"primary"`, `"secondary"`, `"danger"`, `"light"`, and `"da
|
|||||||
For more information, see [Theming your App](/docs/theming/theming-your-app).
|
For more information, see [Theming your App](/docs/theming/theming-your-app).
|
||||||
|
|
||||||
|
|
||||||
|
#### disabled
|
||||||
|
|
||||||
|
boolean
|
||||||
|
|
||||||
|
If true, the user cannot interact with the item. Defaults to `false`.
|
||||||
|
|
||||||
|
|
||||||
#### href
|
#### href
|
||||||
|
|
||||||
string
|
string
|
||||||
@ -60,6 +67,13 @@ Default options are: `"primary"`, `"secondary"`, `"danger"`, `"light"`, and `"da
|
|||||||
For more information, see [Theming your App](/docs/theming/theming-your-app).
|
For more information, see [Theming your App](/docs/theming/theming-your-app).
|
||||||
|
|
||||||
|
|
||||||
|
#### disabled
|
||||||
|
|
||||||
|
boolean
|
||||||
|
|
||||||
|
If true, the user cannot interact with the item. Defaults to `false`.
|
||||||
|
|
||||||
|
|
||||||
#### href
|
#### href
|
||||||
|
|
||||||
string
|
string
|
||||||
|
Reference in New Issue
Block a user