fix singleMode click

pull/165/head
tjz 2018-02-24 20:54:55 +08:00
parent 1d214aafe5
commit 83d6ab3ed2
1 changed files with 10 additions and 5 deletions

View File

@ -563,7 +563,11 @@ export default {
}, },
getLabelFromOption (child) { getLabelFromOption (child) {
return getPropValue(child, this.optionLabelProp) let label = getPropValue(child, this.optionLabelProp)
if (Array.isArray(label) && label.length === 1 && !label[0].tag) {
label = label[0].text
}
return label
}, },
getLabelFromProps (value) { getLabelFromProps (value) {
@ -1251,11 +1255,12 @@ export default {
} }
} }
const singleValue = sValue[0] const singleValue = sValue[0]
const key = singleValue.key
selectedValue = ( selectedValue = (
<div <div
key='value' key='value'
class={`${prefixCls}-selection-selected-value`} class={`${prefixCls}-selection-selected-value`}
title={singleValue.title || singleValue.label} title={this.titleMap.get(key) || this.labelMap.get(key)}
style={{ style={{
display: showSelectedValue ? 'block' : 'none', display: showSelectedValue ? 'block' : 'none',
opacity, opacity,
@ -1373,14 +1378,14 @@ export default {
} }
} }
return ( return (
<div class={className} ref='topCtrlRef' onClick={this.muitipleContainerClick}> <div class={className} ref='topCtrlRef' onClick={this.topCtrlContainerClick}>
{this.getPlaceholderElement()} {this.getPlaceholderElement()}
{innerNode} {innerNode}
</div> </div>
) )
}, },
muitipleContainerClick (e) { topCtrlContainerClick (e) {
if (this.openStatus) { if (this.openStatus && !isSingleMode(this.$props)) {
e.stopPropagation() e.stopPropagation()
} }
}, },