自定义 tabbar 无法使用 show() ?
发布于 4 年前 作者 pingbai 9781 次浏览 来自 问答
// 官方例子代码片段
Component({
  pageLifetimes: {
    showfunction() {
      // 页面被展示
      console.log('show')
    },
    hidefunction() {
      // 页面被隐藏
      console.log('hide')
    },
    resizefunction(size{
      // 页面尺寸变化
    }
  },
  data: {
    selected0,
    color"#7A7E83",
    selectedColor"#3cc51f",
    list: [{
      pagePath"/index/index",
      iconPath"/image/icon_component.png",
      selectedIconPath"/image/icon_component_HL.png",
      text"组件"
    }, {
      pagePath"/index/index2",
      iconPath"/image/icon_API.png",
      selectedIconPath"/image/icon_API_HL.png",
      text"接口"
    }]
  },
  attached() {
  },
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      wx.switchTab({url})
      this.setData({
        selected: data.index
      })
    }
  }
})

求解决,急急急

回到顶部