From c451a865d14f9c9f5c32d85089431397951a0792 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 27 Jul 2016 13:37:20 +0800 Subject: [PATCH] Fix Cascader item overflow style, close #2515 --- components/cascader/demo/basic.md | 28 ++++++++++++++++++++++++++-- components/cascader/style/index.less | 11 ++++++----- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/components/cascader/demo/basic.md b/components/cascader/demo/basic.md index d64df70c65..cb73044938 100644 --- a/components/cascader/demo/basic.md +++ b/components/cascader/demo/basic.md @@ -16,7 +16,31 @@ const options = [{ label: '杭州', children: [{ value: 'xihu', - label: '西湖', + label: '西湖西湖西湖西湖西湖西湖', + }, { + value: 'xihu1', + label: '西湖西湖西湖西湖西湖西湖', + }, { + value: 'xihu2', + label: '西湖西湖西湖西湖西湖西湖', + }, { + value: 'xihu3', + label: '西湖西湖西湖西湖西湖西湖', + }, { + value: 'xihu4', + label: '西湖西湖西湖西湖西湖西湖', + }, { + value: 'xihu5', + label: '西湖西湖西湖西湖西湖西湖', + }, { + value: 'xihu6', + label: '西湖西湖西湖西湖西湖西湖', + }, { + value: 'xihu7', + label: '西湖西湖西湖西湖西湖西湖', + }, { + value: 'xihu8', + label: '西湖西湖西湖西湖西湖西湖', }], }], }, { @@ -27,7 +51,7 @@ const options = [{ label: '南京', children: [{ value: 'zhonghuamen', - label: '中华门', + label: '中华门中华门中华门中华门中华门', }], }], }]; diff --git a/components/cascader/style/index.less b/components/cascader/style/index.less index 2ed7b36fdf..537b7ff3cc 100644 --- a/components/cascader/style/index.less +++ b/components/cascader/style/index.less @@ -27,13 +27,16 @@ &-label { position: absolute; - top: 0; - left: 8px; + left: 0; height: 20px; line-height: 20px; top: 50%; margin-top: -10px; white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + width: 100%; + padding: 0 12px 0 8px; } &-clear { @@ -137,11 +140,9 @@ } } &-menu-item { - padding: 7px 16px; + padding: 7px 26px 7px 16px; cursor: pointer; white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; transition: all 0.3s ease; &:hover { background: tint(@primary-color, 90%);