index.ts 851 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // pages/index/index.ts
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. },
  8. /**
  9. * 生命周期函数--监听页面加载
  10. */
  11. onLoad() {
  12. },
  13. clickItem: function (event: any) {
  14. console.log(event.target.id)
  15. switch (Number(event.target.id)) {
  16. case 0:
  17. console.log("click teacher")
  18. break;
  19. case 1:
  20. console.log("click installer")
  21. break;
  22. case 2:
  23. console.log("click repairman")
  24. break;
  25. case 3:
  26. console.log("click it")
  27. break;
  28. }
  29. this.toLoginPage(Number(event.target.id))
  30. },
  31. toLoginPage: function (type: any) {
  32. wx.navigateTo({
  33. url: '../login/login?id=' + type,
  34. })
  35. },
  36. })