index.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //index.js
  2. //获取应用实例
  3. const app = getApp()
  4. import { lookInit } from '../../component/look/look';
  5. import { myInit } from '../../component/mys/mys';
  6. import httpRequestApi from '../../utils/APIRequest';
  7. Page({
  8. data: {
  9. tab:[
  10. {
  11. name: '看',
  12. templates: 'look',
  13. img: '../../static/image/look1.png',
  14. selectimg: '../../static/image/look2.png'
  15. },
  16. {
  17. name: '搜',
  18. templates: 'search',
  19. img: '../../static/image/sou1.png',
  20. selectimg: '../../static/image/sou2.png'
  21. }, {
  22. name: '我的',
  23. templates: 'mys',
  24. img: '../../static/image/my1.png',
  25. selectimg: '../../static/image/my2.png'
  26. }
  27. ],
  28. ind: 0,
  29. templates: 'look',
  30. },
  31. //tab点击
  32. switcher: function({currentTarget}) {
  33. let ind = currentTarget.dataset.ind;
  34. let templates = this.data.tab[ind].templates;
  35. //console.log(this.data[ind])
  36. this.setData({
  37. ind,
  38. templates
  39. })
  40. },
  41. onLoad: function () {
  42. lookInit(this);
  43. myInit(this);
  44. },
  45. })