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