index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. const setData = require('../../utils/processingData');
  2. Component({
  3. options: {
  4. addGlobalClass: true,
  5. },
  6. /**
  7. * 组件的属性列表
  8. */
  9. properties: {
  10. /* 选择用户列表下标 */
  11. userIndex: {
  12. type: Number,
  13. value: 0
  14. }
  15. },
  16. /**
  17. * 组件的初始数据
  18. */
  19. data: {
  20. userList: [], //用户列表
  21. },
  22. /* 组件的生命周期 */
  23. lifetimes: {
  24. attached: function () {
  25. // 在组件实例进入页面节点树时执行
  26. let list = getApp().globalData.account_list;
  27. const userList = setData.imageType(list, "headportrait");
  28. this.setData({
  29. userList
  30. });
  31. }
  32. },
  33. /**
  34. * 组件的方法列表
  35. */
  36. methods: {
  37. /* 用户账号选择 */
  38. userChange(e) {
  39. // console.log(e)
  40. const {
  41. index
  42. } = e.currentTarget.dataset;
  43. this.triggerEvent('userChange', {
  44. userIndex: index
  45. })
  46. }
  47. }
  48. })