const varMethod = "varMethod"class Page{ current = 1 pageSize = 10 #dd = "dd" // 公有属性 constructor (props) { this.data = props.data; // 默认返回Page的对象实例,然而能够自定义返回对象 } static target = "target attr" // 动态属性 static method() { // 静态方法 return "static method" } [varMethod ] () { return "varMethod" } get current1() { // 如果和current反复,则自身不失效 return "haha" + this.current } set current1 (value) { if(value < 0) { console.log("current 不能") return false } this.current = value } valueOf() { // 数值转换时后调用,隐式调用也会 return 9527 } toString () { return `[object Page]` } }