美文网首页
ionic3 自定义侧边栏

ionic3 自定义侧边栏

作者: Kathy丶Andy | 来源:发表于2018-04-10 09:12 被阅读0次
  1. 使用Ionic创建组件快捷命令

     ionic g component menu 
    

文件目录结构


image.png image.png

在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

image.png

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

相关文章

网友评论

      本文标题:ionic3 自定义侧边栏

      本文链接:https://www.haomeiwen.com/subject/nwjihftx.html