一、类
1.普通类
class Config {
list
Api
constructor(basedata: any, Api: any) {
this.list = basedata
this.Api =Api
}
SonFinish() {
console.log(this.Api)
}
}
export default Config
2.类的继承
class BooksConfig extends BaseConfig {
constructor(Api: any) {
super([],Api)
}
}
export default BooksConfig
二、解构
const record = {supplierId:1,cateName:2}
const { supplierId, cateName } = record;
const supplierId = record.supplierId;
const cateName = record.cateName;
const data = { name: 123, pname: { cname: 99 } };
const { name, pname: { cname } } = data;
console.log(name);
console.log(cname);