common-config.js 862 B

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * 基础数据
  3. */
  4. class Config {
  5. constructor () {
  6. this.state = {
  7. datas: {
  8. padding_top: { title: '上边距', type: 'number', value: 0, col: 4, },
  9. padding_bottom: { title: '下边距', type: 'number', value: 0, col: 4, },
  10. padding_left: { title: '左边距', type: 'number', value: 0, col: 4, },
  11. padding_right: { title: '右边距', type: 'number', value: 0, col: 4, },
  12. },
  13. styles: {}
  14. }
  15. }
  16. /**
  17. * 合并数据
  18. * @param {Object} datas
  19. * @param {Object} styles
  20. * @returns {Object}
  21. */
  22. merge (data) {
  23. const __data = data;
  24. Object.keys(this.state).map(key => {
  25. __data[key] = Object.assign(__data[key], this.state[key]);
  26. });
  27. return __data;
  28. }
  29. }
  30. export default new Config();