fix: transfer handleClear not work

pull/22/head
tjz 7 years ago
parent d148108be3
commit 4582da3725

@ -72,7 +72,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
</div>
<div class="ant-transfer-list-body ant-transfer-list-body-with-search">
<div class="ant-transfer-list-body-search-wrapper">
<div handleClear="function () { [native code] }">
<div>
<input value="" placeholder="Search here" type="text" class="ant-input ant-transfer-list-search ant-transfer-list-search"><span class="ant-transfer-list-search-action"><i class="anticon anticon-search"></i></span></div>
</div>
<div class="ant-transfer-list-content-warp"></div>
@ -94,7 +94,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
</div>
<div class="ant-transfer-list-body ant-transfer-list-body-with-search">
<div class="ant-transfer-list-body-search-wrapper">
<div handleClear="function () { [native code] }">
<div>
<input value="" placeholder="Search here" type="text" class="ant-input ant-transfer-list-search ant-transfer-list-search"><span class="ant-transfer-list-search-action"><i class="anticon anticon-search"></i></span></div>
</div>
<div class="ant-transfer-list-content-warp"></div>

@ -9,7 +9,7 @@ exports[`renders ./components/transfer/demo/advanced.md correctly 1`] = `
</div>
<div class="ant-transfer-list-body ant-transfer-list-body-with-search">
<div class="ant-transfer-list-body-search-wrapper">
<div handleClear="function () { [native code] }">
<div>
<input value="" placeholder="Search here" type="text" class="ant-input ant-transfer-list-search ant-transfer-list-search"><span class="ant-transfer-list-search-action"><i class="anticon anticon-search"></i></span></div>
</div>
<div class="ant-transfer-list-content-warp"></div>
@ -34,7 +34,7 @@ exports[`renders ./components/transfer/demo/advanced.md correctly 1`] = `
</div>
<div class="ant-transfer-list-body ant-transfer-list-body-with-search">
<div class="ant-transfer-list-body-search-wrapper">
<div handleClear="function () { [native code] }">
<div>
<input value="" placeholder="Search here" type="text" class="ant-input ant-transfer-list-search ant-transfer-list-search"><span class="ant-transfer-list-search-action"><i class="anticon anticon-search"></i></span></div>
</div>
<div class="ant-transfer-list-content-warp"></div>
@ -183,7 +183,7 @@ exports[`renders ./components/transfer/demo/search.md correctly 1`] = `
</div>
<div class="ant-transfer-list-body ant-transfer-list-body-with-search">
<div class="ant-transfer-list-body-search-wrapper">
<div handleClear="function () { [native code] }">
<div>
<input value="" placeholder="Search here" type="text" class="ant-input ant-transfer-list-search ant-transfer-list-search"><span class="ant-transfer-list-search-action"><i class="anticon anticon-search"></i></span></div>
</div>
<div class="ant-transfer-list-content-warp"></div>
@ -205,7 +205,7 @@ exports[`renders ./components/transfer/demo/search.md correctly 1`] = `
</div>
<div class="ant-transfer-list-body ant-transfer-list-body-with-search">
<div class="ant-transfer-list-body-search-wrapper">
<div handleClear="function () { [native code] }">
<div>
<input value="" placeholder="Search here" type="text" class="ant-input ant-transfer-list-search ant-transfer-list-search"><span class="ant-transfer-list-search-action"><i class="anticon anticon-search"></i></span></div>
</div>
<div class="ant-transfer-list-content-warp"></div>

@ -7,6 +7,7 @@ export const TransferSearchProps = {
prefixCls: PropTypes.string,
placeholder: PropTypes.string,
value: PropTypes.any,
handleClear: PropTypes.func,
}
export default {
@ -18,15 +19,17 @@ export default {
handleChange (e) {
this.$emit('change', e)
},
handleClear (e) {
handleClear2 (e) {
e.preventDefault()
this.$emit('handleClear', e)
if (this.handleClear) {
this.handleClear(e)
}
},
},
render () {
const { placeholder, value, prefixCls } = getOptionProps(this)
const icon = (value && value.length > 0) ? (
<a href='#' class={`${prefixCls}-action`} onClick={this.handleClear}>
<a href='#' class={`${prefixCls}-action`} onClick={this.handleClear2}>
<Icon type='cross-circle' />
</a>
) : (

Loading…
Cancel
Save