File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -386,6 +386,7 @@ const Cascader = {
386
386
disabled,
387
387
allowClear,
388
388
showSearch = false ,
389
+ notFoundContent,
389
390
...otherProps
390
391
} = props ;
391
392
const getPrefixCls = this . configProvider . getPrefixCls ;
@@ -441,9 +442,21 @@ const Cascader = {
441
442
] ) ;
442
443
443
444
let options = props . options ;
444
- if ( inputValue ) {
445
- options = this . generateFilteredOptions ( prefixCls , renderEmpty ) ;
445
+ const names = getFilledFieldNames ( this . $props ) ;
446
+ if ( options && options . length > 0 ) {
447
+ if ( inputValue ) {
448
+ options = this . generateFilteredOptions ( prefixCls , renderEmpty ) ;
449
+ }
450
+ } else {
451
+ options = [
452
+ {
453
+ [ names . label ] : notFoundContent || renderEmpty ( h , 'Cascader' ) ,
454
+ [ names . value ] : 'ANT_CASCADER_NOT_FOUND' ,
455
+ disabled : true ,
456
+ } ,
457
+ ] ;
446
458
}
459
+
447
460
// Dropdown menu should keep previous status until it is fully closed.
448
461
if ( ! sPopupVisible ) {
449
462
options = this . cachedOptions ;
@@ -459,7 +472,7 @@ const Cascader = {
459
472
}
460
473
// The default value of `matchInputWidth` is `true`
461
474
const resultListMatchInputWidth = showSearch . matchInputWidth !== false ;
462
- if ( resultListMatchInputWidth && inputValue && this . $refs . input ) {
475
+ if ( resultListMatchInputWidth && ( inputValue || isNotFound ) && this . $refs . input ) {
463
476
dropdownMenuColumnStyle . width = this . $refs . input . $el . offsetWidth + 'px' ;
464
477
}
465
478
// showSearch时,focus、blur在input上触发,反之在ref='picker'上触发
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import Api from './components/api';
12
12
import './components' ;
13
13
import demoBox from './components/demoBox' ;
14
14
import demoContainer from './components/demoContainer' ;
15
- import Test from '../components/tree /demo/index.vue' ;
15
+ import Test from '../components/empty /demo/index.vue' ;
16
16
import zhCN from './theme/zh-CN' ;
17
17
import enUS from './theme/en-US' ;
18
18
Vue . use ( Vuex ) ;
You can’t perform that action at this time.
0 commit comments