| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| <!-- Created by Tw93 on 17/03/31. --> |
| |
| <template> |
| <wxc-tab-bar :tab-titles="tabTitles" |
| :tab-styles="tabStyles" |
| title-type="icon" |
| @wxcTabBarCurrentTabSelected="wxcTabBarCurrentTabSelected"> |
| <div class="item-container" :style="contentStyle"><text>首页</text></div> |
| <div class="item-container" :style="contentStyle"><text>特别推荐</text></div> |
| <div class="item-container" :style="contentStyle"><text>消息中心</text></div> |
| <div class="item-container" :style="contentStyle"><text>我的主页</text></div> |
| </wxc-tab-bar> |
| </template> |
| |
| <style scoped> |
| .item-container { |
| width: 750px; |
| background-color: #f2f3f4; |
| align-items: center; |
| justify-content: center; |
| } |
| </style> |
| <script> |
| import { WxcTabBar, Utils } from '../../index'; |
| import Config from './config' |
| import { setTitle } from '../_mods/set-nav'; |
| |
| export default { |
| components: { WxcTabBar }, |
| data: () => ({ |
| tabTitles: Config.tabTitles, |
| tabStyles: Config.tabStyles |
| }), |
| created () { |
| setTitle('TabBar'); |
| const tabPageHeight = Utils.env.getPageHeight(); |
| const { tabStyles } = this; |
| this.contentStyle = { height: (tabPageHeight - tabStyles.height) + 'px' }; |
| }, |
| methods: { |
| wxcTabBarCurrentTabSelected (e) { |
| const index = e.page; |
| // console.log(index); |
| } |
| } |
| }; |
| </script> |