From 3a37327ec158743720f81d375e8efa3a0e8113b5 Mon Sep 17 00:00:00 2001 From: rex Date: Mon, 25 May 2020 15:18:20 +0800 Subject: [PATCH] feat(grid): add new prop direction (#3192) fix #3180 --- example/pages/grid/index.wxml | 8 +++++++- packages/grid-item/index.less | 13 +++++++++++++ packages/grid-item/index.ts | 11 ++++++++++- packages/grid-item/index.wxml | 2 +- packages/grid/index.ts | 4 ++++ 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/example/pages/grid/index.wxml b/example/pages/grid/index.wxml index e6f6cbfa..56280724 100644 --- a/example/pages/grid/index.wxml +++ b/example/pages/grid/index.wxml @@ -30,6 +30,12 @@ + + + + + + @@ -37,7 +43,7 @@ - + diff --git a/packages/grid-item/index.less b/packages/grid-item/index.less index c43fc105..d824ab8a 100644 --- a/packages/grid-item/index.less +++ b/packages/grid-item/index.less @@ -41,13 +41,26 @@ left: 0; } + &--horizontal { + flex-direction: row; + + .van-grid-item__icon + .van-grid-item__text { + margin-top: 0; + margin-left: @padding-xs; + } + } + &--clickable:active { .theme(background-color, '@grid-item-content-active-color'); } } &__icon { + display: flex; + align-items: center; + .theme(font-size, '@grid-item-icon-size'); + .theme(height, '@grid-item-icon-size'); } &__text { diff --git a/packages/grid-item/index.ts b/packages/grid-item/index.ts index f20f9c4c..1678b601 100644 --- a/packages/grid-item/index.ts +++ b/packages/grid-item/index.ts @@ -36,7 +36,15 @@ VantComponent({ } const { data, children } = this.parent; - const { columnNum, border, square, gutter, clickable, center } = data; + const { + columnNum, + border, + square, + gutter, + clickable, + center, + direction, + } = data; const width = `${100 / columnNum}%`; const styleWrapper = []; @@ -76,6 +84,7 @@ VantComponent({ square, gutter, clickable, + direction, }); }, diff --git a/packages/grid-item/index.wxml b/packages/grid-item/index.wxml index 061f43c3..57a96281 100644 --- a/packages/grid-item/index.wxml +++ b/packages/grid-item/index.wxml @@ -2,7 +2,7 @@ diff --git a/packages/grid/index.ts b/packages/grid/index.ts index 4332b3fc..fdc1b32b 100644 --- a/packages/grid/index.ts +++ b/packages/grid/index.ts @@ -37,6 +37,10 @@ VantComponent({ value: true, observer: 'updateChildren', }, + direction: { + type: String, + observer: 'updateChildren', + }, }, data: {