TypeScript 模块的导出、导入
作者:互联网
Module 模块
-
export
:导出模块-
point.ts 文件的内容(导出)
-
interface IPoint{ num:number printNum:() => void; } // 关键字 export 导出模块 export class Point implements IPoint{ constructor(public num:number){ this.num = num; } printNum= () => { console.log(this.num) }; }
-
-
import { 类 | 方法 | 变量 } from 'ts文件路径(不带后缀)'
-
app.ts 文件的内容(导入)
-
import {Point} from './point' const point = new Point(832) point.printNum()
-
标签:TypeScript,point,Point,导入,ts,num,export,模块,printNum 来源: https://www.cnblogs.com/jiyu-hlzy/p/15938428.html