1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <template>
- <view class="u-col" :class="[
- 'u-col-' + span
- ]" :style="{
- padding: `0 ${Number(gutter)/2 + 'rpx'}`,
- marginLeft: 100 / 12 * offset + '%',
- flex: `0 0 ${100 / 12 * span}%`
- }">
- <slot></slot>
- </view>
- </template>
- <script>
-
- export default {
- name: "u-col",
- props: {
-
- span: {
- type: [Number, String],
- default: 12
- },
-
- offset: {
- type: [Number, String],
- default: 0
- },
- },
- inject: ['gutter'],
- }
- </script>
- <style lang="scss">
- .u-col {
-
- float: left;
-
- }
- .u-col-0 {
- width: 0;
- }
- .u-col-1 {
- width: calc(100%/12);
- }
- .u-col-2 {
- width: calc(100%/12 * 2);
- }
- .u-col-3 {
- width: calc(100%/12 * 3);
- }
- .u-col-4 {
- width: calc(100%/12 * 4);
- }
- .u-col-5 {
- width: calc(100%/12 * 5);
- }
- .u-col-6 {
- width: calc(100%/12 * 6);
- }
- .u-col-7 {
- width: calc(100%/12 * 7);
- }
- .u-col-8 {
- width: calc(100%/12 * 8);
- }
- .u-col-9 {
- width: calc(100%/12 * 9);
- }
- .u-col-10 {
- width: calc(100%/12 * 10);
- }
- .u-col-11 {
- width: calc(100%/12 * 11);
- }
- .u-col-12 {
- width: calc(100%/12 * 12);
- }
- </style>
|