Webapp font size follows system font size scaling

in a recent project, using the front end of vue development, the native webview nests H5 pages. The leader wants to make the H5 pages in webview become larger after the font size of the mobile phone system becomes larger. Now some places in H5 can become larger, some are not larger, and they are not uniform. Adaptation is the use of rem to do the adaptation, individual text label font size can be larger, like the input box input,textarea in the font size is not larger, has anyone done similar, but there is a solution.

Mar.13,2022

because the rem adaptation method is used, after discussing with his Android colleague, after he gets the font size adjusted by the system, he will send me the zoom ratio. I will resize the fontsize on the html according to the parameters he passed, and then the elements on the page will naturally be resized according to the size of the root element.

setScaleFont(){
      let fontScale=1;
      let scaleFontSize;
      let initFontSize;
      fontScale=parseFloat(window._nativeMe.getFontScale());
      console.log(`:${fontScale}`);
      let docHtml=document.getElementsByTagName("html")[0];
      initFontSize=this.getStyle(docHtml,'fontSize').split('px')[0];
      scaleFontSize=fontScale*initFontSize;//1-1.4
      docHtml.style.fontSize=scaleFontSize +'px';
    },
    getStyle(obj, name){
      if(window.currentStyle){
        return obj.currentStyle[name];
      }
      else{
        return getComputedStyle(obj, false)[name];
      }
    },

this method is only applicable to Android. Apple cannot get the zoom of the system font size due to permission problems, so it is invalid. If there is a big god who has a way to solve the problem of zooming in and out of Apple, please let me know. I would appreciate it

Menu