JSUtils – 自定义EventEmitter
class EventEmitter { constructor() { this.events = {}; } on(type, handler) { if (!this.eve…
WeApp – 变量未定义或变量设置为undefined时不会同步wxml
建议为变量赋值时定义 null 兜底 const res = opts.param || null; this.setData({ res })
Video – 标签四周出现黑色边框问题
如图:视频周围出现了黑色线条 解决方案:在video标签加上css样式:mix-blend-mode: darken; 更多解释参考:https://blog.csdn.net/q…
WeApp – 小程序Video组件真机下底部出现黑边
如下图 video 标签已配置 object-fit: cover翻查微信开放社区后,发现此问题官方暂未优化掉。https://developers.weixin.qq.com/c…
Typescript – 配置项目别名Alias
日常我们code时,大多数人习惯喜欢使用@/path/file导入文件,而不是../../../path/file的方式导入。 在Typescript中配置Alisa 打开 tsc…
Linux – 配置Node环境变量
修改/etc/profile文件,在末尾添加以下内容 export NODE_HOME=/usr/local/node # Node所在路径 export PATH=$NODE_H…
Mongodb – 错误码:E11000 duplicate key error collection 如何设置unique可为空
一般我们在创建用户信息表时,常见有phone、email等唯一约束的字段,但是这些字段可能在用户注册时为空的,如果在Schema定义时只有unique: true,在插入数据时将会…
WeApp – 小程序自定义文字水印组件
预览效果 代码 // components/text-watermark/index.js Component({ options: { multipleSlots: true /…
Typescript – Error: Cannot find module ‘@/xxx’ 找不到模块
参考:https://www.5axxw.com/questions/content/t8ci4x 已经在tsconfig.json 中配置了paths别名,编辑的时候引用正常,但…
WeApp – 真机scroll-view 中设置border-radius无效?
在节点上设置样式:transform: translate3d(0, 0, 0);
Demo – 老虎机抽奖(H5)
案例地址:http://jsrun.net/IPTKp 预览图:
React – TypeScript 50 条规范和经验
转自 https://cloud.tencent.com/developer/article/1446958
Nginx – Rewrite 重定向
Nginx - Rewrite 重定向 同时给一台服务器绑定多个域名 #域名1 server{ listen 80; server_name www.web.com; index …
Request – 文件流下载
如何将后台的文件流下载? Axios示例 Excel 下载 axios.get(APIURL, params, { responseType: 'arraybuffer'//这也行…
React – Component 细节整理
React Component 目录 React 组件细节 componentDidMount只执行一次(最后更新:2021-03-18 14:48) componentDidMo…
Node – 请求提交参数大小超范围(Request Entity Too Large)
Node.js上传文件提示HTTP请求体超出大小 报错信息: PayloadTooLargeError: request entity too large 默认的Node.js服务…