0.5
The "wxc-tabbar" tag implements a specialized component that corresponds to the radio-style selection. It displays tabs at the bottom of the window for selecting between the different modes and for displaying different weex pages for that mode.
This component supports no child components.
tab-items
: This attribute contains an array of tabitem objects, each of which corresponds to the radio-style selection. The order of the items in this attribute corresponds to the order of the items onscreen. You can configure the appearance of tabbar by setting tabitem. Each tabitem properties can be described as follows.
visible
| hidden
. This attribute must be set to identify the display status. Default value is visible
.
selected-color
: <color> The color of the title when it is selected. Default is red color.
unselected-color
: <color> The color of the title when it is unselected. Default is black color.
Other attributes please check out the common attributes.
common styles: check out common styles for components
position
related styles
opacity
, background-color
etc.
tabBar.onClick
: triggered when the tabitem is selected. You need to register the observer in ready or create block.
require('weex-components')
should be used with webpack, see example for more detail.
<template> <div style="flex-direction: column;"> <wxc-tabbar tab-items = {{tabItems}}></wxc-tabbar> </div> </template> <script> require('weex-components'); module.exports = {
data: {
tabItems: [
{
index: 0,
title: '...',
titleColor: '#000000',
icon: '',
image: '...',
selectedImage: '...',
src: '...',
visibility: 'visible',
},
{
index: 1,
title: '...',
titleColor: '#000000',
icon: '',
image: '...',
selectedImage: '...',
src: '...',
visibility: 'hidden',
}
],
},
methods: {
ready: function (e) { var vm = this;
vm.$on('tabBar.onClick',function(e){ var index = e.detail.index;
....
});
},
}
} </script>