angular 2 - 003 typescript

http://www.typescriptlang.org/docs/index.htmlhtml

var book: string = "hellp angular 2";
var num: number = 123;

function lg (msg :string): void{
  console.log(msg)
}

类和接口typescript

interface Shape{
  area(): number;
}

class Rectangle implements Shape{
  constructor(
      private width: number.
       private length: number
  ){}

//实现方法
  area(){
    return this.width  * this.length;
  }
}

装饰器this

 

相关文章
相关标签/搜索