审查视图

wxcomponents/vant/dist/grid-item/index.wxs 700 字节
1  
倪静楠 authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');

function wrapperStyle(data) {
  var width = 100 / data.columnNum + '%';

  return style({
    width: width,
    'padding-top': data.square ? width : null,
    'padding-right': addUnit(data.gutter),
    'margin-top':
      data.index >= data.columnNum && !data.square
        ? addUnit(data.gutter)
        : null,
  });
}

function contentStyle(data) {
  return data.square
    ? style({
        right: addUnit(data.gutter),
        bottom: addUnit(data.gutter),
        height: 'auto',
      })
    : '';
}

module.exports = {
  wrapperStyle: wrapperStyle,
  contentStyle: contentStyle,
};