- 采用模板引入实现各个页面tabBar
- 在
template.js
中定义tabBar生成函数 - 函数参数
bindName
代表模板中使用的数组名称;id
表示第几个tabBar,从0
开始;target
表示绑定当前页面的this
- 在对应页面的wxml文件中引入模板,如下所示:
<import src="../../template/template_tab.wxml" /> <template is="tabBar" data="{{...bindData}}" />
- 样式文件可以在
app.wxss
中全局引入,也可以在每个用到tabBar页面的wxss文件中单独引入,就像这样:@import "/template/template_tab.wxss";
- 在需要使用tabBar页面的js文件中引入
template.js
,就像这样:import { tabBarFunc } from '../../utils/template'
- 在对应页面js文件的onLoad函数中使用
tabBarFunc("tabBar", 0, this)
来生成tabBar,其中0
表示第一个tabBar,1
表示第二个tabBar,以此类推
-
Notifications
You must be signed in to change notification settings - Fork 0
hushiking/mini-program
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
mini-program tabBar
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published