index.js 578 B

123456789101112131415161718192021222324252627282930
  1. Page({
  2. /**
  3. * 页面的初始数据
  4. */
  5. data: {
  6. background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
  7. currentType: '1'
  8. },
  9. /**
  10. * 生命周期函数--监听页面加载
  11. */
  12. onShow() {
  13. if (typeof this.getTabBar === 'function') {
  14. this.getTabBar().setData({
  15. selected: 1
  16. })
  17. }
  18. },
  19. selectType({
  20. target
  21. }) {
  22. if (target.dataset.type) {
  23. this.setData({
  24. currentType: target.dataset.type
  25. })
  26. }
  27. }
  28. })