会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
zhx119
Powered by
博客园
博客园
|
首页
|
新随笔
|
联系
|
订阅
|
管理
上一页
1
2
3
4
5
6
7
···
16
下一页
2019年12月31日
ts 泛型
摘要: 泛型:软件工程中,我们不仅要创建一致的定义良好的API,同时也要考虑可重用性。 组件不仅能够支持当前的数据类型,同时也能支持未来的数据类型,这在创建大型系统时为你提供了十分灵活的功能。 在像C#和Java这样的语言中,可以使用泛型来创建可重用的组件,一个组件可以支持多种类型的数据。 这样用户就可以以
阅读全文
posted @ 2019-12-31 08:45 zhx119
阅读(157)
评论(0)
推荐(0)
编辑
2019年12月30日
typescript接口设置只读和任意类型
摘要: interface student { readonly id: string; // 只读属性 name: string; age?: number; // 可选属性 gender: string; [propName: string]: any // 任意属性} let Jhon = { id:
阅读全文
posted @ 2019-12-30 14:25 zhx119
阅读(333)
评论(0)
推荐(0)
编辑
什么是接口?
摘要: 在面向对象语言中,接口(Interfaces)是一个很重要的概念,它是对行为的抽象,而具体如何行动需要由类(classes)去实现(implements)。 ypeScript 中的接口是一个非常灵活的概念,除了可用于对类的一部分行为进行抽象以外,也常用于对「对象的形状(Shape)」进行描述。一个
阅读全文
posted @ 2019-12-30 14:22 zhx119
阅读(252)
评论(0)
推荐(0)
编辑
解读es6 class 中 constructor 方法 和 super 的作用
摘要: ES6 的 class 属于一种“语法糖”,所以只是写法更加优雅,更加像面对对象的编程,其思想和 ES5 是一致的。类和模块的内部,默认就是严格模式,所以不需要使用use strict指定运行模式。 //定义类class Point { constructor(x, y) { this.x = x;
阅读全文
posted @ 2019-12-30 10:58 zhx119
阅读(701)
评论(0)
推荐(0)
编辑
2019年12月26日
ts 函数接口
摘要: 函数类型接口对方法的参数及返回值进行约束 例子: interface entry { (key: string, value: string): string; } var md5: entry = function(key: string, value: string): string { ret
阅读全文
posted @ 2019-12-26 22:04 zhx119
阅读(740)
评论(0)
推荐(0)
编辑
ts 属性接口
摘要: ts 属性接口就是对象的约束 例如: interface FullName { firstName: string; secondName: string; } function printName(name: FullName) { console.log(name.firstName + "--
阅读全文
posted @ 2019-12-26 21:32 zhx119
阅读(539)
评论(0)
推荐(0)
编辑
typescript中的抽象类
摘要: 1.用abstract关键字定义抽象类和抽象方法,抽象类中的抽象方法不包含具体实现并且必须在派生类中实现。 2. abstract抽象方法只能放在抽象类里面 3. 抽象类和抽象方法用来定义标准 。 标准:Animal 这个类要求它的子类必须包含eat方法 例子: abstract class Ani
阅读全文
posted @ 2019-12-26 20:55 zhx119
阅读(2115)
评论(0)
推荐(0)
编辑
2019年11月25日
Angular get 请求数据
摘要: Angular5.x 以后 get、post 和和服务器交互使用的是 HttpClientModule 模块,如果jsonp需要引入模块HttpClientJsonpModule 。 在 app.module.ts 中引入 并注入 1、在 app.module.ts 中引入HttpClientMod
阅读全文
posted @ 2019-11-25 16:50 zhx119
阅读(233)
评论(0)
推荐(0)
编辑
Angular 中使用第三方模块 axios 请求数据
摘要: 1、安装 axios 1、安装 axios 1、安装 axios 1、安装 axios cnpm install axios --save 2、用到的地方引入 axios import axios from 'axios'; 3创建angular服务 ng g service services/ht
阅读全文
posted @ 2019-11-25 16:02 zhx119
阅读(1275)
评论(0)
推荐(1)
编辑
angular 创建服务
摘要: ng g service my-new-service 创建到指定目录下面 ng g service services/storage 1.app.module.ts 里面引入创建的服务 import { StorageService} './services/storage.service'; 2
阅读全文
posted @ 2019-11-25 15:25 zhx119
阅读(196)
评论(0)
推荐(0)
编辑
上一页
1
2
3
4
5
6
7
···
16
下一页