shrink.js 774 B

12345678910111213141516171819202122232425262728293031323334353637
  1. Component({
  2. options: {
  3. addGlobalClass: true // 启用全局样式
  4. },
  5. properties: {
  6. title: {
  7. type: String
  8. },
  9. open: {
  10. type: Boolean,
  11. value: false
  12. }, //是否展开
  13. onChange: {
  14. type: Function,
  15. }
  16. },
  17. lifetimes: {
  18. attached: function () {
  19. getApp().globalData.Language.getLanguagePackage(this)
  20. this.setData({
  21. show: this.data.open
  22. })
  23. }
  24. },
  25. data: {
  26. show: false,
  27. },
  28. methods: {
  29. changeShow() {
  30. const show = !this.data.show
  31. this.setData({
  32. show
  33. })
  34. this.triggerEvent("onChange", show)
  35. }
  36. }
  37. })