picker.js 688 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. Page({
  2. data: {
  3. array: ['中国', '美国', '巴西', '日本'],
  4. objectArray: [
  5. {
  6. id: 0,
  7. name: '美国',
  8. },
  9. {
  10. id: 1,
  11. name: '中国',
  12. },
  13. {
  14. id: 2,
  15. name: '巴西',
  16. },
  17. {
  18. id: 3,
  19. name: '日本',
  20. },
  21. ],
  22. arrIndex: 0,
  23. index: 0
  24. },
  25. bindPickerChange(e) {
  26. console.log('picker发送选择改变,携带值为', e.detail.value);
  27. this.setData({
  28. index: e.detail.value,
  29. });
  30. },
  31. bindObjPickerChange(e) {
  32. console.log('picker发送选择改变,携带值为', e.detail.value);
  33. this.setData({
  34. arrIndex: e.detail.value,
  35. });
  36. },
  37. });