12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <template>
- <view>
- <u-tabbar v-model="myCurrent" :list="tabbarList" :before-switch="beforeSwitch" inactive-color="#ADB8C2" active-color="#5098FF">
- </u-tabbar>
- </view>
- </template>
- <script>
- var img1=require('@/assets/img/tabbarImg/home-wifi-fill.svg')
- var img2=require('@/assets/img/tabbarImg/home-wifi-fill2.svg')
- var img3=require('@/assets/img/tabbarImg/chat-1-fill.svg')
- var img4=require('@/assets/img/tabbarImg/chat-1-fill2.svg')
- var img5=require('@/assets/img/tabbarImg/chat-smile-2-fill.svg')
- var img6=require('@/assets/img/tabbarImg/chat-smile-2-fill2.svg')
- export default {
- name: "Tabbar",
- props: {
- current: 0,
- elderStatus: false,
- prefetchNum:0,
- },
- data() {
- return {
- oldindex: this.current,
- myCurrent: this.current,
- tabbarList: [{
- iconPath: img1,
- selectedIconPath: img2,
- text: '主页 ',
- pagePath2: "/pages/index/index",
- },
-
- {
- count:this.prefetchNum,
- iconPath: img3,
- selectedIconPath: img4,
- text: '消息',
- pagePath2: "/pages/message/message",
-
- },
-
- {
- iconPath: img5,
- selectedIconPath: img6,
- text: '我的',
- pagePath2: "/pages/mine/mine",
- }
- ],
- };
- },
- methods: {
-
- setcount(c) {
- this.myCurrent = c
- },
- beforeSwitch(index) {
- if (index == this.current) {
- return false
- }
- var url = this.tabbarList[index].pagePath2;
- uni.navigateTo({
- url: url
- })
- if (index == 1) {
- this.myCurrent = this.oldindex;
- return false;
- } else {
- return true;
- }
- },
- },
-
- mounted() {
- //this.tabbarList[1].count=this.prefetchNum;
- },
- destroyed() {
- }
- }
- </script>
- <style>
- </style>
|