index.js 531 B

1234567891011121314151617181920212223242526
  1. import { VantComponent } from '../common/component';
  2. VantComponent({
  3. relation: {
  4. name: 'row',
  5. type: 'ancestor',
  6. current: 'col',
  7. },
  8. props: {
  9. span: Number,
  10. offset: Number,
  11. },
  12. data: {
  13. viewStyle: '',
  14. },
  15. methods: {
  16. setGutter(gutter) {
  17. const padding = `${gutter / 2}px`;
  18. const viewStyle = gutter
  19. ? `padding-left: ${padding}; padding-right: ${padding};`
  20. : '';
  21. if (viewStyle !== this.data.viewStyle) {
  22. this.setData({ viewStyle });
  23. }
  24. },
  25. },
  26. });