一.关闭发布包时的两步验证
如果没有开启两步验证直接看下一步
前往https://www.npmjs.com/settings/yourname/tfa/list
取消勾选Require two-factor authentication for write actions然后点击Update Preferences更新设置
如果没有开启两步验证直接看下一步
前往https://www.npmjs.com/settings/yourname/tfa/list
取消勾选Require two-factor authentication for write actions然后点击Update Preferences更新设置
FullCalendar点击日期事件不执行,返回错误:Unknown option 'dateClick'
首先确保引入以下库:
npm安装依赖时提示:cb() never called的解决方法:
或者:
安装python3.x(node-gyp 依赖python3.x) 和 python2.7 然后执行:npm config set python python2.7
安装 Visual Studio Build Tools 或 Visual Studio 2017 Community,然后执行:npm config set msvs_version 2017
如果最后安装卡在 Successfully installed Python 2.7,执行以下步骤:
win + r 打开运行窗口
输入 然后回车 %temp%
在打开的文件夹中新建文件: 然后保存dd_client_.log 并写入 Closing installer. Return code: 3010.
参考文档
使用forEach循环异步函数时,会先整个循环一遍,然后再输出异步函数的结果,这样就没法在循环结束后拿到异步函数的结果,正确的写法应该是用递归方法,等待异步函数执行完毕后才进入下一次循环。下面是两种写法的执行结果。
实现方法很简单,将总数计算出来显示到title,title显示位置调整到饼图中间,设置zlevel属性置于底层;鼠标悬停时显示的label也显示在饼图中间,调整背景色及边距, 设置zlevel属性 置于title上方,鼠标悬停时显示label就会遮挡住title。
promise实例
let $http = {
post:function(url,params){
let promise = new Promise(function(resolve, reject){
$.ajax({
url:url,
method:'post',
data:params?params:null,
complete:function(res){
if(this.status === 200 || this.status === 304) {
resolve(res);
} else {
reject(new Error(this.statusText));
}
}
});
});
return promise;
}
};
调用:
$http.post('http://url.com').then((res)=>{
if(res.success==true) {
console.success(res;
}
})
.catch((err)=>{
console.error(err);
});