-
创建component文件夹
-
创建navigation文件夹,创建navigation组件
-
navigation.json
bash{ "component": true, "usingComponents": {} } -
navigation.wxml
bash<view class="navigation"> <van-icon wx:if="{{showBack}}" custom-class="left" name="arrow-left" color="black" size="22" bind:tap="back"/> <text class="center">{{title}}</text> </view> -
navication.scss
bash.navigation{ display: flex; height: 130rpx; background-color:#ffffff; padding-top: 20rpx; justify-content: center; position: relative; border-bottom: 1px solid #ebfeca; .left{ position: absolute; left: 10rpx; } .center{ margin-top: 55rpx; } } -
navigation.js
bash// component/navigation.js Component({ /** * 组件的属性列表 */ properties: { title:{ type:String, value:"标题" }, showBack:{ type:Boolean, value:false } }, /** * 组件的方法列表 */ methods: { back(){ wx.navigateBack() } } }) -
组件的使用
bash<navigation showBack title="个人信息"></navigation>- title :中间区域的标题信息
- showBack :是否显示返回按钮
微信小程序-自定义简易顶部导航
勿语&2024-03-11 11:11
相关推荐
00后程序员张1 天前
python 抓包在实际项目中的合理位置,结合代理抓包、设备侧抓包与数据流分析2501_915918411 天前
使用 HBuilder 上架 iOS 应用时常见的问题与应对方式2501_916007472 天前
iOS 崩溃日志的分析方法,将崩溃日志与运行过程结合分析2501_916007472 天前
React Native 混淆在真项目中的方式,当 JS 和原生同时暴露00后程序员张2 天前
苹果应用商店上架App流程,签名证书、IPA 校验、上传2501_916007472 天前
iOS 上架需要哪些准备,围绕证书、描述文件和上传方式等关键环节展开分析qq_12498707532 天前
基于微信小程序的私房菜定制上门服务系统(源码+论文+部署+安装)2501_915106322 天前
iOS 上架费用解析,哪些成本可以通过流程优化降低。换日线°2 天前
微信小程序找不同游戏(有效果图)风月歌2 天前
小程序项目之超市售货管理平台小程序源代码(源码+文档)