1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
| <template>
| <view class="">
| <view class="u-demo">
| <view class="u-config-wrap">
| <view class="u-config-title u-border-bottom">
| 参数配置
| </view>
| <view class="u-config-item">
| <view class="u-item-title">状态</view>
| <u-subsection :list="['显示', '隐藏']" @change="showChange"></u-subsection>
| </view>
| <view class="u-config-item">
| <view class="u-item-title">凸起按钮</view>
| <u-subsection :list="['显示', '隐藏']" @change="minButtonChange"></u-subsection>
| </view>
| <view class="u-config-item">
| <view class="u-item-title">背景色</view>
| <u-subsection :list="['#ffffff', '#1f1f1d']" @change="bgColorChange"></u-subsection>
| </view>
| <view class="u-config-item">
| <view class="u-item-title">顶部边框</view>
| <u-subsection :list="['显示', '隐藏']" @change="borderTopChange"></u-subsection>
| </view>
| <view class="u-config-item">
| <view class="u-item-title">提示角标</view>
| <u-subsection :list="['显示', '隐藏']" @change="badgeChange"></u-subsection>
| </view>
| </view>
| </view>
| <u-tabbar
| v-model="current"
| :show="show"
| :bg-color="bgColor"
| :border-top="borderTop"
| :list="list"
| :mid-button="midButton"
| :inactive-color="inactiveColor"
| :activeColor="activeColor"
| ></u-tabbar>
| </view>
| </template>
|
| <script>
| export default {
| data() {
| return {
| current: 0,
| show: true,
| bgColor: '#ffffff',
| borderTop: true,
| list: [{
| iconPath: "home",
| selectedIconPath: "home-fill",
| text: '首页',
| count: 2,
| isDot: true,
| customIcon: false,
| },
| {
| iconPath: "photo",
| selectedIconPath: "photo-fill",
| text: '放映厅',
| customIcon: false,
| },
| {
| iconPath: "/static/uview/example/min_button.png",
| selectedIconPath: "/static/uview/example/min_button_select.png",
| text: '发布',
| midButton: true,
| customIcon: false,
| },
| {
| iconPath: "play-right",
| selectedIconPath: "play-right-fill",
| text: '直播',
| customIcon: false,
| },
| {
| iconPath: "account",
| selectedIconPath: "account-fill",
| text: '我的',
| count: 23,
| isDot: false,
| customIcon: false,
| },
| ],
| midButton: true,
| inactiveColor: '#909399',
| activeColor: '#5098FF'
| }
| },
| methods: {
| beforeSwitch(index) {
| return true;
| },
| showChange(index) {
| this.show = !index;
| },
| bgColorChange(index) {
| if(index == 0) {
| this.activeColor = '#5098FF';
| this.inactiveColor = '#909399';
| }
| if(index == 1) {
| this.activeColor = '#D0D0D0';
| this.inactiveColor = '#5A5A5A';
| }
| this.bgColor = ['#ffffff', '#1f1f1d'][index];
| },
| borderTopChange(index) {
| this.borderTop = !index;
| },
| badgeChange(index) {
| if (index == 1) {
| this.list[0].count = 0;
| this.list[4].count = 0;
| } else {
| this.list[0].count = 2;
| this.list[4].count = 23;
| }
| },
| minButtonChange(index) {
| this.midButton = !index;
| }
| }
| }
| </script>
|
| <style scoped lang="scss">
| .u-demo-area {
| margin: 0 -40rpx;
| }
| </style>
|
|