myInfo.ts 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // component/myInfo/myInfo.ts
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. },
  8. /**
  9. * 组件的初始数据
  10. */
  11. data: {
  12. region: ['北京市', '北京市', '海淀区'],
  13. schoolArray: ['中国', '美国', '巴西', '日本'],
  14. schoolIndex: 0,
  15. classArray: ['一年级一班', '一年级2班', '一年级3班', '一年级4班'],
  16. classIndex: 0,
  17. isShowPassWord: true
  18. },
  19. /**
  20. * 组件的方法列表
  21. */
  22. methods: {
  23. bindSchoolPicker: function (event: any) {
  24. let newArray;
  25. switch (Number(event.detail.value)) {
  26. case 0:
  27. newArray = ["一", "二", "三"];
  28. this.setData({
  29. classArray: newArray,
  30. classIndex: 0
  31. })
  32. break;
  33. case 1:
  34. newArray = ["4", "5", "6"];
  35. this.setData({
  36. classArray: newArray,
  37. classIndex: 0
  38. })
  39. break;
  40. case 2:
  41. newArray = ["as", "ad", "af"];
  42. this.setData({
  43. classArray: newArray,
  44. classIndex: 0
  45. })
  46. break;
  47. case 3:
  48. newArray = ["b1", "b2", "b3"];
  49. this.setData({
  50. classArray: newArray,
  51. classIndex: 0
  52. })
  53. break;
  54. }
  55. this.setData({
  56. schoolIndex: event.detail.value
  57. })
  58. },
  59. bindClssPicker: function (event: any) {
  60. this.setData({
  61. classIndex: event.detail.value
  62. })
  63. },
  64. showPwdTab: function () {
  65. if (this.data.isShowPassWord) {
  66. this.setData({
  67. isShowPassWord: false
  68. })
  69. } else {
  70. this.setData({
  71. isShowPassWord: true
  72. })
  73. }
  74. }
  75. }
  76. })