From 873c0ab25f4baf8b5c961555557650e6a2e630d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=95=8F?= Date: Wed, 3 May 2017 11:21:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9Acell=E5=90=8C?= =?UTF-8?q?=E6=97=B6=E8=AE=BE=E7=BD=AEtitle=E5=92=8Clabel=E6=97=B6?= =?UTF-8?q?=EF=BC=8Cvalue=E4=B8=8D=E5=B1=85=E4=B8=AD=20(#26)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修复:cell同时设置title和label时,value不居中 --- docs/examples-docs/cell.md | 17 +++++++++++++++-- packages/vant-css/src/cell.css | 13 ++++++++----- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/docs/examples-docs/cell.md b/docs/examples-docs/cell.md index 90e090c03..8c3a7d91f 100644 --- a/docs/examples-docs/cell.md +++ b/docs/examples-docs/cell.md @@ -58,6 +58,19 @@ export default { ``` ::: +#### 只设置value + +只设置`value`时会向左对齐。 + +:::demo 只设置value +```html + + + + +``` +::: + #### 标题带描述信息 传入`label`属性,属性值为描述信息的值。 @@ -65,8 +78,8 @@ export default { :::demo 标题带描述信息 ```html - - + + ``` ::: diff --git a/packages/vant-css/src/cell.css b/packages/vant-css/src/cell.css index 9226456d3..cdfacbed2 100644 --- a/packages/vant-css/src/cell.css +++ b/packages/vant-css/src/cell.css @@ -14,7 +14,8 @@ } @b cell { - display: block; + width: 100%; + display: table; position: relative; padding: 10px 15px 10px 0; box-sizing: border-box; @@ -36,7 +37,7 @@ } @e title { - float: left; + display: table-cell; } @e label { @@ -47,15 +48,17 @@ } @e value { - float: right; + display: table-cell; + text-align: right; + vertical-align: middle; overflow: hidden; @m link { - margin-right: 20px; + padding-right: 20px; } @m alone { - float: none; + text-align: left; } }