fontSizeSetting.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <page-meta :page-font-size="fontValue+'px'" :root-font-size="fontValue+'px'"></page-meta>
  3. <view>
  4. <cu-custom bgImage="/static/bg.png" :isBack="true">
  5. <template v-slot:content>
  6. <text class="text-black">字体设置</text>
  7. </template>
  8. </cu-custom>
  9. <view class="contentIncolumnC" style="margin-top: 40rpx;">
  10. <view style="width: 80%;">
  11. <slider :value="fontValue" @change="sliderChange" min="10" max="30"/>
  12. </view>
  13. <view class="contentInRowS" style="width: 80%;margin-top: 10px;">
  14. <text @click="setfontsize(10)">最小</text>
  15. <text @click="setfontsize(20)">标准</text>
  16. <text @click="setfontsize(30)">最大</text>
  17. </view>
  18. <view class="text-center" style="width: 80%;margin-top: 80rpx;">
  19. <button class="cu-btn bg-zblue border lg" style="width: 100%;" @tap="submit">保存</button>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script setup lang="ts">
  25. import CuCustom from '@/colorui/components/cu-custom.vue'
  26. import MessageUtils from "@/utils/MessageUtils";
  27. import {onLoad} from '@dcloudio/uni-app'
  28. import {ref} from "vue";
  29. import Auth from "@/api/Auth";
  30. const fontValue=ref(Auth.getfontSize());
  31. onLoad(() =>{
  32. fontValue.value=Auth.getfontSize();
  33. })
  34. const sliderChange=(e:any)=>{
  35. console.log(e.detail.value);
  36. fontValue.value=e.detail.value;
  37. }
  38. const submit=(e)=>{
  39. Auth.setfontSize(fontValue.value);
  40. MessageUtils.success('保存成功');
  41. }
  42. const setfontsize=(size:number)=>{
  43. fontValue.value=size;
  44. }
  45. </script>
  46. <style scoped>
  47. @import url('@/static/css/main.css');
  48. </style>