index.js 794 B

12345678910111213141516171819202122232425262728293031323334
  1. Component({
  2. options: {
  3. addGlobalClass: true
  4. },
  5. properties: {
  6. iconName: {
  7. type: String,
  8. value: "icon-rili1"
  9. },
  10. title: {
  11. type: String,
  12. },
  13. onChange: {
  14. type: Function,
  15. },
  16. },
  17. lifetimes: {
  18. attached: function () {
  19. getApp().globalData.Language.getLanguagePackage(this)
  20. }
  21. },
  22. data: {
  23. value: new Date().toISOString().split('T')[0], // 默认值为今天,格式为 YYYY-MM-DD
  24. },
  25. methods: {
  26. onChange(e) {
  27. if (e.detail.value == this.data.value) return;
  28. this.setData({
  29. value: e.detail.value
  30. })
  31. this.triggerEvent("onChange", e.detail.value)
  32. },
  33. }
  34. })