2021-03-10

205 阅读1分钟

IOS兼容性问题,location.href 无效的解决办法

1. 利用 <a> 标签模拟点击来跳转
2. 用 window.location 来跳转

需要注意的是,IOS中这两种都不能夸协议跳转,既http跳https

打包后页面显示,但资源加载失败

  1. 检查打包后的index.html中的资源加载路径与项目中publicPathassetsDir及vue-router的base的对比,看是否有错误
  2. 检查是否存在协议不匹配的情况,例如index.html中存在是否存在强制协议升级,csp,例如: <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">

Dom.classList.toggle($className);

// 如果 visible 类值已存在,则移除它,否则添加它
div.classList.toggle("visible");

// add/remove visible, depending on test conditional, i less than 10
div.classList.toggle("visible", i < 10 );

字符与ascii码互转换

大写字母A-Z对应的ASCII码值是65-90
小写字母a-z对应的ASCII码值是97-122

var str = "A";
str.charCodeAt();  // 65

var str1 = 'a';
str1.charCodeAt();  // 97

var num = 97;
String.fromCharCode(num);  // 'a'

var num1 = 100;
String.fromCharCode(num1);  // 'd'