mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
fix(item): pass the correct type property to the button tag
fixes #14740
This commit is contained in:
8
core/src/components.d.ts
vendored
8
core/src/components.d.ts
vendored
@ -3299,6 +3299,10 @@ declare global {
|
|||||||
*/
|
*/
|
||||||
'routerDirection': RouterDirection;
|
'routerDirection': RouterDirection;
|
||||||
'state': 'valid' | 'invalid' | 'focus';
|
'state': 'valid' | 'invalid' | 'focus';
|
||||||
|
/**
|
||||||
|
* The type of the button. Only used when an `onclick` or `button` property is present. Possible values are: `"submit"`, `"reset"` and `"button"`. Default value is: `"button"`
|
||||||
|
*/
|
||||||
|
'type': 'submit' | 'reset' | 'button';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3358,6 +3362,10 @@ declare global {
|
|||||||
*/
|
*/
|
||||||
'routerDirection'?: RouterDirection;
|
'routerDirection'?: RouterDirection;
|
||||||
'state'?: 'valid' | 'invalid' | 'focus';
|
'state'?: 'valid' | 'invalid' | 'focus';
|
||||||
|
/**
|
||||||
|
* The type of the button. Only used when an `onclick` or `button` property is present. Possible values are: `"submit"`, `"reset"` and `"button"`. Default value is: `"button"`
|
||||||
|
*/
|
||||||
|
'type'?: 'submit' | 'reset' | 'button';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,15 +61,22 @@ export class Item {
|
|||||||
*/
|
*/
|
||||||
@Prop() lines?: 'full' | 'inset' | 'none';
|
@Prop() lines?: 'full' | 'inset' | 'none';
|
||||||
|
|
||||||
// TODO document this
|
|
||||||
@Prop() state?: 'valid' | 'invalid' | 'focus';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When using a router, it specifies the transition direction when navigating to
|
* When using a router, it specifies the transition direction when navigating to
|
||||||
* another page using `href`.
|
* another page using `href`.
|
||||||
*/
|
*/
|
||||||
@Prop() routerDirection?: RouterDirection;
|
@Prop() routerDirection?: RouterDirection;
|
||||||
|
|
||||||
|
// TODO document this
|
||||||
|
@Prop() state?: 'valid' | 'invalid' | 'focus';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of the button. Only used when an `onclick` or `button` property is present.
|
||||||
|
* Possible values are: `"submit"`, `"reset"` and `"button"`.
|
||||||
|
* Default value is: `"button"`
|
||||||
|
*/
|
||||||
|
@Prop() type: 'submit' | 'reset' | 'button' = 'button';
|
||||||
|
|
||||||
|
|
||||||
@Listen('ionStyle')
|
@Listen('ionStyle')
|
||||||
itemStyle(ev: UIEvent) {
|
itemStyle(ev: UIEvent) {
|
||||||
@ -131,11 +138,11 @@ export class Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { href, detail, mode, win, state, detailIcon, el, routerDirection } = this;
|
const { href, detail, mode, win, state, detailIcon, el, routerDirection, type } = this;
|
||||||
|
|
||||||
const clickable = this.isClickable();
|
const clickable = this.isClickable();
|
||||||
const TagType = clickable ? (href ? 'a' : 'button') : 'div';
|
const TagType = clickable ? (href ? 'a' : 'button') : 'div';
|
||||||
const attrs = TagType === 'button' ? { type: 'button' } : { href };
|
const attrs = TagType === 'button' ? { type: type } : { href };
|
||||||
const showDetail = detail != null ? detail : mode === 'ios' && clickable;
|
const showDetail = detail != null ? detail : mode === 'ios' && clickable;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -35,6 +35,10 @@
|
|||||||
<ion-label>button[ion-item]</ion-label>
|
<ion-label>button[ion-item]</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
|
<ion-item button type="submit" id="attachClick">
|
||||||
|
<ion-label>button[ion-item] type="submit"</ion-label>
|
||||||
|
</ion-item>
|
||||||
|
|
||||||
<ion-item class="activated" onClick="testClick(event)">
|
<ion-item class="activated" onClick="testClick(event)">
|
||||||
<ion-label>button[ion-item].activated</ion-label>
|
<ion-label>button[ion-item].activated</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
Reference in New Issue
Block a user