first commit
This commit is contained in:
16
uni_modules/tdesign-uniapp/components/mixins/theme-change.js
Normal file
16
uni_modules/tdesign-uniapp/components/mixins/theme-change.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import { appBaseInfo } from '../common/utils';
|
||||
|
||||
export const themeMixin = {
|
||||
data() {
|
||||
return {
|
||||
theme: 'light',
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.theme = appBaseInfo.theme;
|
||||
if (typeof uni.onThemeChange !== 'function') return;
|
||||
uni.onThemeChange((t) => {
|
||||
this.theme = t.theme;
|
||||
});
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user