-
Notifications
You must be signed in to change notification settings - Fork 554
Closed
Description
遇到的问题
切换tab的时候,对应的template需要改变
<template name="tab-post">
<view> 发布宝贝 </view>
</template>
<template name="tab-profile">
<view> 个人中心 </view>
</template>
<!--index.wxml-->
<view class="container">
<view>
<template is="{{tabTemplate}}"></template>
</view>
<mp-tabbar current="{{tabIndex}}" list="{{list}}" bindchange="tabChangeHandler"></mp-tabbar>
</view>
目前,在切换tab时,只能通过更新 bindchange
返回的 detail.index
来计算模板名称
能否通过在list对象中内置一个属性来表示对应的template ?
特性方案
list: [
{
"text": "发布宝贝",
"template": "tab-post",
"iconPath": "/assets/icons/post-inactive.png",
"selectedIconPath": "/assets/icons/post-active.png",
},
{
"text": "个人中心",
"template": "tab-profile",
"iconPath": "/assets/icons/profile-inactive.png",
"selectedIconPath": "/assets/icons/profile-active.png",
}
]
Metadata
Metadata
Assignees
Labels
No labels