picker-view

注意:其中只可放置 组件,其他节点不会显示。

picker-view-column

示例代码

  1. //picker-view.js
  2. const date = new Date();
  3. const years = [2019,2020,2021];
  4. const months = [1,2,3,4,5,6,7,8,9,10,11,12];
  5. const options = {
  6. data: {
  7. year: date.getFullYear(),
  8. months: months,
  9. month: 2,
  10. value: [9999, 1, 1],
  11. },
  12. pickerViewChange(e) {
  13. month: this.data.months[e.detail.value[1]],
  14. });
  15. this.addEventItem(e);
  16. console.log('picker-view change ,值为', e.detail.value);
  17. }
  18. };
  19. Page(options);
Tip