baseModel.js 722 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * Created by Macheng on 2019/02/22.
  3. */
  4. class BaseModel {
  5. isCreate = false
  6. extProp1 = ''
  7. extProp2 = ''
  8. extProp3 = ''
  9. extProp4 = ''
  10. extProp5 = ''
  11. init(opts) {
  12. if (!opts) opts = {}
  13. this.isCreate = opts['isCreate'] || false
  14. this.extProp1 = opts['extProp1'] || ''
  15. this.extProp2 = opts['extProp2'] || ''
  16. this.extProp3 = opts['extProp3'] || ''
  17. this.extProp4 = opts['extProp4'] || ''
  18. this.extProp5 = opts['extProp5'] || ''
  19. }
  20. toJson() {
  21. return {
  22. isCreate: this.isCreate,
  23. extProp1: this.extProp1,
  24. extProp2: this.extProp2,
  25. extProp3: this.extProp3,
  26. extProp4: this.extProp4,
  27. extProp5: this.extProp5
  28. }
  29. }
  30. }
  31. export default BaseModel