index.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <template>
  2. <view :class="'custom-class ' + utils.bem('col', [span]) + ' ' + (offset ? 'van-col--offset-' + offset : '')" :style="viewStyle">
  3. <slot />
  4. </view>
  5. </template>
  6. <script module="utils" lang="wxs" src="@/node_modules/@vant/weapp/lib/wxs/utils.wxs"></script>
  7. <script>
  8. 'use strict';
  9. Object.defineProperty(exports, '__esModule', {
  10. value: true
  11. });
  12. var component_1 = require('../common/component');
  13. component_1.VantComponent({
  14. relation: {
  15. name: 'row',
  16. type: 'ancestor',
  17. current: 'col'
  18. },
  19. props: {
  20. span: Number,
  21. offset: Number
  22. },
  23. data: {
  24. viewStyle: ''
  25. },
  26. methods: {
  27. setGutter: function (gutter) {
  28. var padding = gutter / 2 + 'px';
  29. var viewStyle = gutter ? 'padding-left: ' + padding + '; padding-right: ' + padding + ';' : '';
  30. if (viewStyle !== this.viewStyle) {
  31. this.setData({
  32. viewStyle: viewStyle
  33. });
  34. }
  35. }
  36. }
  37. });
  38. </script>
  39. <style>
  40. @import './index.css';
  41. </style>