多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[TOC] ## 示例 ## hello world old: ``` function Student(name) { this.name = name; } Student.prototype.hello = function () { alert('Hello, ' + this.name + '!'); } ``` new: ``` export class Student { constructor(name) { this.name = name; } hello() { alert('Hello, ' + this.name + '!'); } } ``` 调用方式都是一样 ``` // 导入 import {Student} from "student.js" var student = new Student("word"); student.hello() ``` ### 传入对象 ``` export class person{ constructor({name,age}) { this.name=name this.age=age } echo(){ return this.name+this.age } } ``` 调用 ``` import {person} from "person.js"; let good1 =new person({name:"cpj",age:123}); ```