储能智慧云小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

theme-change.js 603B

1234567891011121314151617181920212223242526
  1. const themeChangeBehavior = Behavior({
  2. data: {
  3. theme: 'light',
  4. },
  5. attached() {
  6. this._initTheme();
  7. },
  8. methods: {
  9. _initTheme() {
  10. const that = this;
  11. wx.getSystemInfo({
  12. success(res) {
  13. that.setData({
  14. theme: res.theme,
  15. });
  16. },
  17. });
  18. wx.onThemeChange((res) => {
  19. that.setData({
  20. theme: res.theme,
  21. });
  22. });
  23. },
  24. },
  25. });
  26. export default themeChangeBehavior;