随笔分类 - JS
摘要:// promise(丑陋的) class UglyPromise { constructor(callback){ this.status = 'pending' this.value = undefined this.sucessCb = [] this.failedCb = [] const
阅读全文
posted @ 2022-09-26 19:12
豆浆不要油条
摘要:// 判断是否是某类型 const isType = (obj, type) => { if (typeof obj !== 'object') return false; const typeString = Object.prototype.toString.call(obj); let fla
阅读全文
posted @ 2022-09-26 19:08
豆浆不要油条
摘要:// url的queryString转成对象 function queryStr2Obj(url) { const query = {}; const search = url.split('?')[1]; if (!search) { return {} } search.split('&').f
阅读全文
posted @ 2022-09-26 19:04
豆浆不要油条
摘要:一个乱写的推广转盘,很乱但是效果还行 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="vi
阅读全文
摘要:// visibilityChange事件兼容性写法 var hidden, visibilityChange; if (typeof document.hidden !== "undefined") { // Opera 12.10 and Firefox 18 and later support
阅读全文
摘要:vue项目根据后端返回的路由动态生成并添加 RouterView代码: <template> <router-view></router-view> </template> RouterView只是用来中继子页面,才能让页面保持正常展示 如下图是前端页面文件结构 这是后台配置(URL就是路由路径,也
阅读全文
摘要:阿里oss上传工具函数,首先需要先安装依赖 npm install ali-oss,还有上传支持压缩使用到了 compressorjs 这个工具库;randomString这个是自写的生成随机字串的函数,用来保证文件名唯一。 1 import OSS from 'ali-oss'; 2 import
阅读全文
摘要:import axios from "axios"; import router from '@/router/index.js'; import { Message } from "element-ui"; import { getToken, removeToken } from '@/util
阅读全文

浙公网安备 33010602011771号