![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
原生JS
飞飞侯
这个作者很懒,什么都没留下…
展开
-
文件上传之压缩图片
compressFile() { const _this = this; const reader = new FileReader(); reader.readAsDataURL(this.file); // 转base64 const loading = this.$loading({ target: document.querySelector("#box"), lock: true, text: "图片文原创 2021-03-27 11:38:06 · 104 阅读 · 0 评论 -
JavaScript实现标题搜索关键词高亮显示
需求:标题搜索keyword,对返回数据str中存在的所有关键词进行高亮显示 解决方案: a计划(对keyword字符串进行循环,在str中出现keyword的地方插入HTML标签): 1.插入HTML标签函数 /** * @param {String} target 需高亮显示的字符串 * @param {String} str 原始字符串 */ showHigh(target,str){ let positions = []; let pos = str.indexOf(target); w原创 2021-03-19 15:54:56 · 613 阅读 · 0 评论