-
使用Ionic创建组件快捷命令
ionic g component menu
文件目录结构


在app.module.ts里面导入这个组件
import { ComponentsModule } from '../components/components.module';
在menu.html里面使用ion-menu标签
<ion-menu [content]="myContent">
</ion-menu>
在menu.ts里面定义myContent
@Input() myContent: any;
在tabs.html里面接收刚才定义的那个myContent

这样就完成了自定义侧边栏,不用在写在app.html里面了
网友评论