index.js 1.72 KB
// custom-tab-bar/index.js
import {
    wyMerchantId
} from '~/utils/request/environment'
Component({
    options: {
        styleIsolation: 'shared'
    },
    data: {
        active: 0,
        initList: [{
                path: "/pages/tab/output/output",
                normal: '/images/output.png',
                active: '/images/output_active.png',
                text: "产值"
            },
            {
                path: "/pages/tab/discovery/discovery",
                normal: '/images/home.png',
                active: '/images/home_active.png',
                text: "发现",
            },
            {
                path: "/pages/tab/mine/mine",
                normal: '/images/mine.png',
                active: '/images/mine_active.png',
                text: "我的"
            }
        ],
        list: [{
                path: "/pages/tab/output/output",
                normal: '/images/output.png',
                active: '/images/output_active.png',
                text: "产值"
            },
            {
                path: "/pages/tab/discovery/discovery",
                normal: '/images/home.png',
                active: '/images/home_active.png',
                text: "发现",
            },
            {
                path: "/pages/tab/mine/mine",
                normal: '/images/mine.png',
                active: '/images/mine_active.png',
                text: "我的"
            }
        ]
    },
    methods: {
        onChange(event) {
            const {
                list
            } = this.data
            this.setData({
                active: event.detail
            })
            wx.switchTab({
                url: list[event.detail].path
            })
        }
    }
})