fix: 优化 select title

pull/165/head
tangjinzhou 7 years ago
parent 00ea4cb4f2
commit eadb117298

@ -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 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 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 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>
</div><span unselectable="unselectable" class="ant-select-arrow"><b></b></span></div> </div><span unselectable="unselectable" class="ant-select-arrow"><b></b></span></div>

@ -201,6 +201,7 @@ export default {
let { label, title } = val let { label, title } = val
label = label === undefined ? this.labelMap.get(key) : label label = label === undefined ? this.labelMap.get(key) : label
title = title === undefined ? this.titleMap.get(key) : title title = title === undefined ? this.titleMap.get(key) : title
title = typeof title === 'string' ? title.trim() : title
labelArr.push([key, label === undefined ? key : label]) labelArr.push([key, label === undefined ? key : label])
titleArr.push([key, title]) titleArr.push([key, title])
}) })
@ -1273,17 +1274,21 @@ export default {
} }
const singleValue = sValue[0] const singleValue = sValue[0]
const key = singleValue.key const key = singleValue.key
let title = this.titleMap.get(key) || this.labelMap.get(key)
if (Array.isArray(title)) {
title = ''
}
selectedValue = ( selectedValue = (
<div <div
key='value' key='value'
class={`${prefixCls}-selection-selected-value`} class={`${prefixCls}-selection-selected-value`}
title={this.titleMap.get(key) || this.labelMap.get(key)} title={title}
style={{ style={{
display: showSelectedValue ? 'block' : 'none', display: showSelectedValue ? 'block' : 'none',
opacity, opacity,
}} }}
> >
{this.labelMap.get(sValue[0].key)} {this.labelMap.get(key)}
</div> </div>
) )
} }

Loading…
Cancel
Save