1:app。index.html
//得到手機屏幕的寬度
var htmlWidth = document.documentElement.clientWidth || document.body.clientWidth;
//得到html的Dom元素
var htmlDom = document.getElementsByTagName('html')[0];
//設置根元素字體大小
htmlDom.style.fontSize = htmlWidth / 20 + 'px';
2:這裏用的是vscode 編輯器
下載插件:px2rem
修改設置