mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feat(button): goback attribute
This commit is contained in:
@@ -9,9 +9,13 @@ export class Anchor {
|
||||
|
||||
@Prop() href: string;
|
||||
|
||||
@Prop() goBack = false;
|
||||
|
||||
render() {
|
||||
return <a
|
||||
href={this.href}
|
||||
onClick={(ev) => openURL(this.href, ev)}><slot/></a>;
|
||||
onClick={(ev) => openURL(this.href, ev, this.goBack)}>
|
||||
<slot/>
|
||||
</a>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
|
||||
## Properties
|
||||
|
||||
#### goBack
|
||||
|
||||
boolean
|
||||
|
||||
|
||||
#### href
|
||||
|
||||
string
|
||||
@@ -14,6 +19,11 @@ string
|
||||
|
||||
## Attributes
|
||||
|
||||
#### go-back
|
||||
|
||||
boolean
|
||||
|
||||
|
||||
#### href
|
||||
|
||||
string
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Component, Element, Prop } from '@stencil/core';
|
||||
import { Config } from '../../index';
|
||||
import { openURL } from '../../utils/theme';
|
||||
import { RouterDirection } from '../router/utils/interfaces';
|
||||
|
||||
@Component({
|
||||
tag: 'ion-back-button',
|
||||
@@ -42,7 +41,7 @@ export class BackButton {
|
||||
ev.preventDefault();
|
||||
nav.pop();
|
||||
} else if (this.defaultHref) {
|
||||
openURL(this.defaultHref, ev, RouterDirection.Back);
|
||||
openURL(this.defaultHref, ev, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ export class Button {
|
||||
*/
|
||||
@Prop() mode: 'ios' | 'md';
|
||||
|
||||
@Prop() goBack = false;
|
||||
/**
|
||||
* Emitted when the button has focus.
|
||||
*/
|
||||
@@ -148,7 +149,7 @@ export class Button {
|
||||
disabled={this.disabled}
|
||||
onFocus={this.onFocus.bind(this)}
|
||||
onKeyUp={this.onKeyUp.bind(this)}
|
||||
onClick={(ev) => openURL(this.href, ev)}
|
||||
onClick={(ev) => openURL(this.href, ev, this.goBack)}
|
||||
onBlur={this.onBlur.bind(this)}>
|
||||
<span class='button-inner'>
|
||||
<slot name='icon-only'></slot>
|
||||
|
||||
@@ -119,6 +119,11 @@ button with a border, or to `"solid"`. The default style is `"solid"` except ins
|
||||
a toolbar, where the default is `"clear"`.
|
||||
|
||||
|
||||
#### goBack
|
||||
|
||||
boolean
|
||||
|
||||
|
||||
#### href
|
||||
|
||||
string
|
||||
@@ -210,6 +215,11 @@ button with a border, or to `"solid"`. The default style is `"solid"` except ins
|
||||
a toolbar, where the default is `"clear"`.
|
||||
|
||||
|
||||
#### go-back
|
||||
|
||||
boolean
|
||||
|
||||
|
||||
#### href
|
||||
|
||||
string
|
||||
|
||||
@@ -54,6 +54,9 @@ export class Item {
|
||||
*/
|
||||
@Prop() tappable = false;
|
||||
|
||||
@Prop() goBack = false;
|
||||
|
||||
|
||||
@Listen('ionStyle')
|
||||
itemStyle(ev: UIEvent) {
|
||||
ev.stopPropagation();
|
||||
@@ -122,7 +125,7 @@ export class Item {
|
||||
<TagType
|
||||
{...attrs}
|
||||
class={themedClasses}
|
||||
onClick={(ev) => openURL(this.href, ev)}>
|
||||
onClick={(ev) => openURL(this.href, ev, this.goBack)}>
|
||||
<slot name='start'></slot>
|
||||
<div class='item-inner'>
|
||||
<div class='input-wrapper'>
|
||||
|
||||
@@ -31,6 +31,11 @@ boolean
|
||||
If true, the user cannot interact with the item. Defaults to `false`.
|
||||
|
||||
|
||||
#### goBack
|
||||
|
||||
boolean
|
||||
|
||||
|
||||
#### href
|
||||
|
||||
string
|
||||
@@ -82,6 +87,11 @@ boolean
|
||||
If true, the user cannot interact with the item. Defaults to `false`.
|
||||
|
||||
|
||||
#### go-back
|
||||
|
||||
boolean
|
||||
|
||||
|
||||
#### href
|
||||
|
||||
string
|
||||
|
||||
Reference in New Issue
Block a user