摘要:
// 安装 npm install crypto-js // utils新建一个js文件,内容如下 export default { Word为需要加密的数据 keyStr为加密所需的秘钥 必须为16位的字符串 // 加密 encrypt (word, keyStr) { if (!word) re 阅读全文
摘要:
阅读全文
摘要:
speak(sentence) { const utterance = new SpeechSynthesisUtterance(sentence) window.speechSynthesis.speak(utterance) } speak(“hello”) * @param sentence: 阅读全文
摘要:
const listChunk = (list, size = 1, cacheList = []) => { const tmp = [...list] if (size <= 0) { return cacheList } while (tmp.length) { cacheList.push( 阅读全文
摘要:
按照换行分割字符串 分割后的字符串集合=待分割的字符串.split(/[\n]/) 按照换行和空格分割字符串 分割后的字符串集合=待分割的字符串.split(/[\s\n]/) 阅读全文
摘要:
function SameMonth(date) { var date1 = new Date(date.replace(/-/g, "/")); //将传入的时间字符串转换成时间对象 var date2 = new Date(); //当前时间 var curDay = date2.getDate 阅读全文
摘要:
function SameWeek(date) { var date1 = new Date(date.replace(/-/g, "/")); //将传入的时间字符串转换成时间对象 var date2 = new Date(); //当前时间 var curWeek = date2.getDay( 阅读全文
摘要:
路由元信息(meta) 如果一个网站有不同的角色,比如 管理员 和 普通用户 ,要求不同的角色能访问的页面是不一样的 这个时候我们就可以 把所有的页面都放在路由表里 ,只要 在访问的时候判断一下角色权限 。如果有权限就让访问,没有权限的话就拒绝访问,跳转到404页面 vue-router 在构建路由 阅读全文
摘要:
function debounce(callback, delay) { return function () { // 保存this和arguments const that = this const args = arguments // 清除待执行的定时器任务 if (callback.tim 阅读全文
摘要:
function throttle(callback, delay) { let start = 0 // 必须保存第一次点击立即调用 return function () { // 它的this是谁就得让callback()中的this是谁, 它接收的所有实参 都直接交给callback() co 阅读全文