Skip to content

Commit

Permalink
fix: 优化 select title
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjinzhou committed May 19, 2018
1 parent 1175996 commit 9314957
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Expand Up @@ -164,7 +164,7 @@ exports[`renders ./components/pagination/demo/custom-changer.md correctly 1`] =
<div class="ant-select ant-select-enabled ant-select ant-select-enabled ant-pagination-options-size-changer">
<div role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false" tabindex="0" class="ant-select-selection ant-select-selection--single">
<div class="ant-select-selection__rendered">
<div title="[object Object],[object Object],[object Object]" class="ant-select-selection-selected-value" style="display: block; opacity: 1;"><span>10条/页</span>
<div title="" class="ant-select-selection-selected-value" style="display: block; opacity: 1;"><span>10条/页</span>
<!---->
</div>
</div><span unselectable="unselectable" class="ant-select-arrow"><b></b></span></div>
Expand Down
9 changes: 7 additions & 2 deletions components/vc-select/Select.jsx
Expand Up @@ -201,6 +201,7 @@ export default {
let { label, title } = val
label = label === undefined ? this.labelMap.get(key) : label
title = title === undefined ? this.titleMap.get(key) : title
title = typeof title === 'string' ? title.trim() : title
labelArr.push([key, label === undefined ? key : label])
titleArr.push([key, title])
})
Expand Down Expand Up @@ -1273,17 +1274,21 @@ export default {
}
const singleValue = sValue[0]
const key = singleValue.key
let title = this.titleMap.get(key) || this.labelMap.get(key)
if (Array.isArray(title)) {
title = ''
}
selectedValue = (
<div
key='value'
class={`${prefixCls}-selection-selected-value`}
title={this.titleMap.get(key) || this.labelMap.get(key)}
title={title}
style={{
display: showSelectedValue ? 'block' : 'none',
opacity,
}}
>
{this.labelMap.get(sValue[0].key)}
{this.labelMap.get(key)}
</div>
)
}
Expand Down

0 comments on commit 9314957

Please sign in to comment.