mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
fix(menuClose): put in ionic directives
This commit is contained in:
@ -13,6 +13,7 @@ export * from 'ionic/components/item/item-group'
|
|||||||
export * from 'ionic/components/menu/menu'
|
export * from 'ionic/components/menu/menu'
|
||||||
export * from 'ionic/components/menu/menu-types'
|
export * from 'ionic/components/menu/menu-types'
|
||||||
export * from 'ionic/components/menu/menu-toggle'
|
export * from 'ionic/components/menu/menu-toggle'
|
||||||
|
export * from 'ionic/components/menu/menu-close'
|
||||||
export * from 'ionic/components/text-input/text-input'
|
export * from 'ionic/components/text-input/text-input'
|
||||||
export * from 'ionic/components/text-input/label'
|
export * from 'ionic/components/text-input/label'
|
||||||
export * from 'ionic/components/list/list'
|
export * from 'ionic/components/list/list'
|
||||||
|
@ -13,10 +13,10 @@ import {IonicApp} from '../app/app';
|
|||||||
'menuClose'
|
'menuClose'
|
||||||
],
|
],
|
||||||
host: {
|
host: {
|
||||||
'(click)': 'close($event)'
|
'(click)': 'close()'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
export class MenuToggle extends Ion {
|
export class MenuClose extends Ion {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
app: IonicApp,
|
app: IonicApp,
|
||||||
@ -26,11 +26,9 @@ export class MenuToggle extends Ion {
|
|||||||
this.app = app;
|
this.app = app;
|
||||||
}
|
}
|
||||||
|
|
||||||
close(ev) {
|
close() {
|
||||||
let menu = this.app.getComponent(this.menuClose || 'menu');
|
let menu = this.app.getComponent(this.menuClose || 'menu');
|
||||||
menu && menu.close();
|
menu && menu.close();
|
||||||
ev.preventDefault();
|
|
||||||
ev.stopPropagation();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import {Navbar} from '../nav-bar/nav-bar';
|
|||||||
'menuToggle'
|
'menuToggle'
|
||||||
],
|
],
|
||||||
host: {
|
host: {
|
||||||
'(click)': 'toggle($event)',
|
'(click)': 'toggle()',
|
||||||
'[hidden]': 'isHidden'
|
'[hidden]': 'isHidden'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -37,11 +37,9 @@ export class MenuToggle extends Ion {
|
|||||||
* TODO
|
* TODO
|
||||||
* @param {TODO} event TODO
|
* @param {TODO} event TODO
|
||||||
*/
|
*/
|
||||||
toggle(ev) {
|
toggle() {
|
||||||
let menu = this.app.getComponent(this.menuToggle || 'menu');
|
let menu = this.app.getComponent(this.menuToggle || 'menu');
|
||||||
menu && menu.toggle();
|
menu && menu.toggle();
|
||||||
ev.preventDefault();
|
|
||||||
ev.stopPropagation();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get isHidden() {
|
get isHidden() {
|
||||||
|
@ -12,7 +12,7 @@ import {NavRegistry} from './nav-registry';
|
|||||||
'params: navParams'
|
'params: navParams'
|
||||||
],
|
],
|
||||||
host: {
|
host: {
|
||||||
'(click)': 'onClick($event)',
|
'(click)': 'onClick()',
|
||||||
'role': 'link'
|
'role': 'link'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -26,7 +26,7 @@ export class NavPush {
|
|||||||
this.registry = registry;
|
this.registry = registry;
|
||||||
}
|
}
|
||||||
|
|
||||||
onClick(event) {
|
onClick() {
|
||||||
let destination, params;
|
let destination, params;
|
||||||
|
|
||||||
if (this.instruction instanceof Array) {
|
if (this.instruction instanceof Array) {
|
||||||
@ -44,17 +44,18 @@ export class NavPush {
|
|||||||
destination = this.registry.get(destination);
|
destination = this.registry.get(destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.nav.push(destination, params);
|
this.nav && this.nav.push(destination, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO
|
* TODO
|
||||||
*/
|
*/
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[nav-pop]',
|
selector: '[nav-pop]',
|
||||||
host: {
|
host: {
|
||||||
'(click)': 'onClick($event)',
|
'(click)': 'onClick()',
|
||||||
'role': 'link'
|
'role': 'link'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -66,7 +67,7 @@ export class NavPop {
|
|||||||
constructor(nav: NavController) {
|
constructor(nav: NavController) {
|
||||||
this.nav = nav;
|
this.nav = nav;
|
||||||
}
|
}
|
||||||
onClick(event) {
|
onClick() {
|
||||||
this.nav.pop();
|
this.nav && this.nav.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,8 @@ import * as util from 'ionic/util';
|
|||||||
import {IonicConfig} from './config';
|
import {IonicConfig} from './config';
|
||||||
import {ionicBootstrap} from '../components/app/app';
|
import {ionicBootstrap} from '../components/app/app';
|
||||||
import {
|
import {
|
||||||
Menu, MenuToggle, Button, Content, Scroll, Refresher,
|
Menu, MenuToggle, MenuClose,
|
||||||
|
Button, Content, Scroll, Refresher,
|
||||||
Slides, Slide, SlideLazy,
|
Slides, Slide, SlideLazy,
|
||||||
Tabs, Tab,
|
Tabs, Tab,
|
||||||
Card, List, ListHeader, Item, ItemGroup, ItemGroupTitle,
|
Card, List, ListHeader, Item, ItemGroup, ItemGroupTitle,
|
||||||
@ -14,7 +15,8 @@ import {
|
|||||||
TextInput, TextInputElement, Label,
|
TextInput, TextInputElement, Label,
|
||||||
Segment, SegmentButton, SegmentControlValueAccessor,
|
Segment, SegmentButton, SegmentControlValueAccessor,
|
||||||
RadioGroup, RadioButton, SearchBar,
|
RadioGroup, RadioButton, SearchBar,
|
||||||
Nav, NavbarTemplate, Navbar, NavPush, NavPop, NavRouter,
|
Nav, NavbarTemplate, Navbar,
|
||||||
|
NavPush, NavPop, NavRouter,
|
||||||
IdRef,
|
IdRef,
|
||||||
ShowWhen, HideWhen
|
ShowWhen, HideWhen
|
||||||
} from '../ionic';
|
} from '../ionic';
|
||||||
@ -34,6 +36,7 @@ export const IONIC_DIRECTIVES = [
|
|||||||
// Content
|
// Content
|
||||||
forwardRef(() => Menu),
|
forwardRef(() => Menu),
|
||||||
forwardRef(() => MenuToggle),
|
forwardRef(() => MenuToggle),
|
||||||
|
forwardRef(() => MenuClose),
|
||||||
|
|
||||||
forwardRef(() => Button),
|
forwardRef(() => Button),
|
||||||
forwardRef(() => Content),
|
forwardRef(() => Content),
|
||||||
@ -81,6 +84,7 @@ export const IONIC_DIRECTIVES = [
|
|||||||
forwardRef(() => Nav),
|
forwardRef(() => Nav),
|
||||||
forwardRef(() => NavbarTemplate),
|
forwardRef(() => NavbarTemplate),
|
||||||
forwardRef(() => Navbar),
|
forwardRef(() => Navbar),
|
||||||
|
|
||||||
forwardRef(() => NavPush),
|
forwardRef(() => NavPush),
|
||||||
forwardRef(() => NavPop),
|
forwardRef(() => NavPop),
|
||||||
forwardRef(() => NavRouter),
|
forwardRef(() => NavRouter),
|
||||||
|
Reference in New Issue
Block a user