PageSetting.js 608 B

12345678910111213141516171819202122232425262728293031323334
  1. import { Collection, Model } from 'js-abstract-model'
  2. class PageSetting extends Model {
  3. constructor (data) {
  4. super(data, [
  5. { key: 'id' },
  6. { key: 'key' },
  7. {
  8. key: 'value',
  9. default: {
  10. sections: [],
  11. layoutConfig: {},
  12. seo: {}
  13. }
  14. }
  15. ])
  16. if (typeof this.value === 'string') {
  17. this.value = JSON.parse(this.value)
  18. }
  19. }
  20. getStringifyValue () {
  21. return JSON.stringify(this.value)
  22. }
  23. }
  24. class PageSettingList extends Collection {
  25. model() {
  26. return PageSetting
  27. }
  28. }
  29. export { PageSetting, PageSettingList }