This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --global alias.lgb "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset%n' --abbrev-commit --date=relative --branches" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function ({ parse }){ | |
return { | |
visitor: { | |
FunctionDeclaration(path){ | |
const node = path.node; | |
const functionName = node.id.name; | |
const consoleLogNode = parse(`console.log(${functionName})`); | |
path.get("body").unshiftContainer("body", consoleLogNode.program.body[0]); | |
}, | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// See https://go.microsoft.com/fwlink/?LinkId=733558 | |
// for the documentation about the tasks.json format | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "compile", | |
"type": "typescript", | |
"tsconfig": "tsconfig.json", | |
"problemMatcher": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array.reduce((acc, cur) => { | |
acc[cur.status] = acc[cur.status] || []; | |
acc[cur.status].push(cur); | |
return acc; | |
}, {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone $REPO && | |
cd "$(basename "$REPO" .git)" && |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @fileoverview 包装小程序api接口, | |
* 用途: | |
* 使项目代码中不包含wx, 便于移植到其他平台 | |
* 异步方法包装成promise | |
* 添加一些逻辑 | |
* | |
* 所有必填参数单独作为参数列出,可选参数放在一个options对象里,例如: | |
* wx.showToast(options), options.title是一定要有的, 所以包装后的函数为 | |
* function(title, options){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class WrappedWxSocket { | |
static CONNECTING = 0; | |
static OPEN = 1; | |
static CLOSING = 2; | |
static CLOSED = 3; | |
constructor(url, protocols) { | |
// FIXME 小程序接口与标准 Websocket 对象不完全一致,因此要做兼容处理 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vm.$listeners | |
2.4.0 新增 | |
类型:{ [key: string]: Function | Array<Function> } | |
只读 | |
详细: | |
包含了父作用域中的 (不含 .native 修饰器的) v-on 事件监听器。它可以通过 v-on="$listeners" 传入内部组件——在创建更高层次的组件时非常有用。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm view <packagename> versions --json |