摘要: <script> function tagsSort(arr, empty) { if (!String.prototype.localeCompare){ console.log("您的浏览器不支持tagsSort,请更新浏览器!"); return false; } var letters = 阅读全文
posted @ 2020-12-18 10:52 大萨特 阅读(755) 评论(0) 推荐(0)
摘要: 字符转ascii码:用charCodeAt();ascii码转字符:用fromCharCode(); 大写字母A 到Z 的值是从65 到90 小写a到z 是从97 到 122 "a".charCodeAt(0)==97String.fromCharCode(97)=="a" 转换成大写:toUppe 阅读全文
posted @ 2020-12-17 11:46 大萨特 阅读(712) 评论(0) 推荐(1)
摘要: 最近项目用到将图片转为base64格式上传,上传时发现字符串里+号全变空格,造成请求回来的base64图片无法查看。 解决方案:将base64上传前进行encodeURIComponent(Base64str)编码 阅读全文
posted @ 2020-11-26 14:28 大萨特 阅读(445) 评论(0) 推荐(0)
摘要: 1.安装axios npm install axios 2.在main.js中引入axios 3.格式:(查询) this.$axios.get(‘http://xxx.xx.xxx/api/xxx‘).then(res => { console.log(res) //查询成功返回的值}).catc 阅读全文
posted @ 2020-11-10 18:24 大萨特 阅读(406) 评论(0) 推荐(0)
摘要: 1.安装vue-cli.(建议安装npm淘宝镜像:npm config set registry https://registry.npm.taobao.org) npm install @vue/cli -g 2.命令行工具进入安装项目路径下运行命令 npm create xxxx(自定项目新文件 阅读全文
posted @ 2020-11-10 18:19 大萨特 阅读(592) 评论(0) 推荐(0)
摘要: 如果有这样一个需求,打印对象中所有的键和值: var person = { name: '张三', age: 18, 2: '2', 11: '11'};1.使用for in: for(var key in person){ console.log(key);}//2 11 age name 2.使 阅读全文
posted @ 2020-11-10 11:13 大萨特 阅读(1496) 评论(0) 推荐(0)
摘要: 函数定义时传入形参对象,参数直接赋予默认值。但注意,当以参数列表形式设置默认值时,赋值方式是按序赋值。 function doSome_Obj({a,b=2,c}){ console.log(a,b,c);}doSome_Obj({a:5,c:22})// 5 2 22function doSome 阅读全文
posted @ 2020-11-10 09:40 大萨特 阅读(2270) 评论(0) 推荐(0)
摘要: import ... from "..."和import {...} from "..."的区别和使用方法。 import ... from "..."的使用方法:// A.js export default 20 // B.js import A from './A'上面的代码生效的前提是,只有在 阅读全文
posted @ 2020-11-09 15:41 大萨特 阅读(1231) 评论(0) 推荐(0)
摘要: 原因:微信开发工具端口未开。 解决方法:打开微信开发工具设置=》通用设置=》安全=》服务端口。 阅读全文
posted @ 2020-11-08 19:06 大萨特 阅读(455) 评论(0) 推荐(0)
摘要: 使用官方组件报错: 解决方法:工具=》插件安装=》安装新插件=》前往插件市场安装=》找到scss/sass编译=》安装 阅读全文
posted @ 2020-11-06 14:47 大萨特 阅读(820) 评论(0) 推荐(0)