在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
NavigationNavigation是小程序的顶部导航组件,当页面配置navigationStyle设置为custom的时候可以使用此组件替代原生导航栏。 示例代码:
<mp-navigation-bar loading="{{loading}}" show="{{show}}" animated="{{animated}}" color="{{color}}" background="{{background}}" title="UI组件库" back="{{true}}"></mp-navigation-bar>
<view class="page">
<view class="page__hd">
<view class="page__title">Navigation</view>
<view class="page__desc">小程序自定义导航栏</view>
</view>
<view class="page__bd page__bd_spacing">
<button class="weui-btn" type="primary" bindtap="toggleLoading">触发loading</button>
<button class="weui-btn" type="primary" bindtap="changeColor">修改文字颜色</button>
<button class="weui-btn" type="primary" bindtap="changeBgColor">修改背景颜色</button>
<button class="weui-btn" type="primary" bindtap="toggleShow">显示 / 隐藏</button>
<button class="weui-btn" type="primary" bindtap="toggleAnimated">设置显示 / 隐藏opacity动画</button>
</view>
</view>
Page({
data: {
loading: false,
color: '#000',
background: '#f8f8f8',
show: true,
animated: false
},
toggleLoading() {
this.setData({
loading: !this.data.loading
})
},
changeColor() {
this.setData({
color: '#07C160'
})
},
changeBgColor() {
this.setData({
background: '#ededed'
})
},
toggleShow() {
this.setData({
show: !this.data.show
})
},
toggleAnimated() {
this.setData({
animated: !this.data.animated,
show: !this.data.show
})
}
}) 属性列表
Slot
TabbarTabbar组件,也可以用来作为小程序的自定义Tabbar使用 示例代码:
<view class="page">
<view class="page__hd">
<view class="page__title">Tabbar</view>
<view class="page__desc">类似小程序原生tabbar的组件,可用于自定义tabbar</view>
</view>
<mp-tabbar style="position:fixed;bottom:0;width:100%;left:0;right:0;" list="{{list}}" bindchange="tabChange"></mp-tabbar>
</view>
Page({
data: {
list: [{
"text": "对话",
"iconPath": "../../images/tabbar_icon_chat_default.png",
"selectedIconPath": "../../images/tabbar_icon_chat_active.png",
dot: true
},
{
"text": "设置",
"iconPath": "../../images/tabbar_icon_setting_default.png",
"selectedIconPath": "../../images/tabbar_icon_setting_active.png",
badge: 'New'
}]
},
tabChange(e) {
console.log('tab change', e)
}
}); 属性列表
list属性是对象数组,每一项表示一个Tabbar项,其字段含义为
|
请发表评论