base.js 891 B

1234567891011121314151617181920212223242526272829303132333435
  1. export default {
  2. created() {
  3. const self = this;
  4. },
  5. mounted() {
  6. const self = this;
  7. },
  8. methods: {
  9. //设置字体
  10. getRootFontSize(){
  11. const self = this;
  12. var fontSize = getApp().globalData.rootFontSize;
  13. if(fontSize){
  14. return fontSize;
  15. }else{
  16. fontSize = uni.getStorageSync('root_font_size');
  17. if(fontSize){
  18. getApp().globalData.rootFontSize=fontSize;
  19. }else{
  20. fontSize='12px';//默认字体大小
  21. self.setRootFontSize(fontSize);
  22. }
  23. return fontSize;
  24. }
  25. },
  26. setRootFontSize(fontSize){
  27. uni.setStorageSync('root_font_size',fontSize);
  28. getApp().globalData.rootFontSize=fontSize;
  29. },
  30. }
  31. }