08 2020 档案

摘要:1.首先安装n模块: sudo npm install -g n 2.升级node.js到最新稳定版 sudo n stable 3.升级到最新版 sudo n latest 4.n后面也可以跟随版本号,升级到任意版本 sudo n v0.10.26或sudo n 0.10.26 5.切换使用版本 阅读全文
posted @ 2020-08-28 14:05 wzndkj 阅读(114) 评论(0) 推荐(0) 编辑
摘要:1、安装brew命令 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 2、安装nginx brew install nginx 3、启动nginx sudo nginx 阅读全文
posted @ 2020-08-26 16:56 wzndkj 阅读(126) 评论(0) 推荐(0) 编辑
摘要:npm install -g cnpm --registry=https://registry.npm.taobao.orgcnpm -v 阅读全文
posted @ 2020-08-26 15:33 wzndkj 阅读(209) 评论(0) 推荐(0) 编辑
摘要:import 'reflect-metadata'; function showData(target: typeof User) { for (let key in target.prototype) { const data = Reflect.getMetadata('data', targe 阅读全文
posted @ 2020-08-17 08:26 wzndkj 阅读(373) 评论(0) 推荐(0) 编辑
摘要:reflect-metadata 是一个库,这个库可以帮助我们在类上面或者类的属性上面去存储一些数据,并且方便的数据获取 安装这个库 npm install reflect-metadata --save import 'reflect-metadata'; const user = { name: 阅读全文
posted @ 2020-08-13 08:25 wzndkj 阅读(1281) 评论(0) 推荐(0) 编辑
摘要:const userInfo: any = undefined; class Test{ getName() { return userInfo.name; } getAge() { return userInfo.age; } } const test = new Test(); test.get 阅读全文
posted @ 2020-08-12 09:01 wzndkj 阅读(468) 评论(0) 推荐(0) 编辑
摘要:/** * 参数装饰器,只要是装饰器一定是函数 * @param target Test 对应的 prototype * @param key 方法名 * @param paramIndex 参数所在的位置 */ function paramDecorator(target: any, method 阅读全文
posted @ 2020-08-11 08:13 wzndkj 阅读(991) 评论(0) 推荐(0) 编辑
摘要:/** * 属性装饰器只能接收到两个参数 * @param target Test 对应的 prototype * @param key 属性名字 */ function nameDecorator(target: any, key: string):any { const descriptor: 阅读全文
posted @ 2020-08-10 08:21 wzndkj 阅读(1039) 评论(0) 推荐(0) 编辑
摘要:访问器譬如 private public protect /** * 访问器装饰器的参数跟方法装饰器的参数是一样的 * @param target prototype * @param key function name * @param descriptor 描述符 */ function vis 阅读全文
posted @ 2020-08-07 08:22 wzndkj 阅读(437) 评论(0) 推荐(0) 编辑
摘要:/** * 装饰器永远是个方法,方法的装饰器,里面的三个参数是规定好的 * * @param target 普通方法 target 对应的是类的 prototype * 静态方法 target 对应的是类的构造函数 * * @param key 装饰方法的名字 * * @param descript 阅读全文
posted @ 2020-08-06 08:21 wzndkj 阅读(497) 评论(0) 推荐(0) 编辑
摘要:// 最外层是个函数,再返回一个新的函数 function testDecorator(flag: boolean) { if (flag) { return function (constructor: any) { constructor.prototype.getName = () => { 阅读全文
posted @ 2020-08-03 08:32 wzndkj 阅读(148) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示