mirror of
				https://gitee.com/vant-contrib/vant.git
				synced 2025-10-31 03:22:08 +08:00 
			
		
		
		
	feat(Cascader): add show-header prop (#10201)
This commit is contained in:
		
							parent
							
								
									e3238d8fa1
								
							
						
					
					
						commit
						be16a493d0
					
				| @ -184,6 +184,7 @@ export default { | |||||||
| | placeholder | Placeholder of unselected tab | _string_ | `Select` | | | placeholder | Placeholder of unselected tab | _string_ | `Select` | | ||||||
| | active-color | Active color | _string_ | `#ee0a24` | | | active-color | Active color | _string_ | `#ee0a24` | | ||||||
| | closeable | Whether to show close icon | _boolean_ | `true` | | | closeable | Whether to show close icon | _boolean_ | `true` | | ||||||
|  | | show-header `v2.12.40` | Whether to show header | _boolean_ | `true` | | ||||||
| | field-names `v2.12.4` | Custom the fields of options | _object_ | `{ text: 'text', value: 'value', children: 'children' }` | | | field-names `v2.12.4` | Custom the fields of options | _object_ | `{ text: 'text', value: 'value', children: 'children' }` | | ||||||
| 
 | 
 | ||||||
| ### Events | ### Events | ||||||
|  | |||||||
| @ -198,6 +198,7 @@ export default { | |||||||
| | placeholder | 未选中时的提示文案 | _string_ | `请选择` | | | placeholder | 未选中时的提示文案 | _string_ | `请选择` | | ||||||
| | active-color | 选中状态的高亮颜色 | _string_ | `#ee0a24` | | | active-color | 选中状态的高亮颜色 | _string_ | `#ee0a24` | | ||||||
| | closeable | 是否显示关闭图标 | _boolean_ | `true` | | | closeable | 是否显示关闭图标 | _boolean_ | `true` | | ||||||
|  | | show-header `v2.12.40` | 是否展示标题栏 | _boolean_ | `true` | | ||||||
| | field-names `v2.12.4` | 自定义 `options` 结构中的字段 | _object_ | `{ text: 'text', value: 'value', children: 'children' }` | | | field-names `v2.12.4` | 自定义 `options` 结构中的字段 | _object_ | `{ text: 'text', value: 'value', children: 'children' }` | | ||||||
| 
 | 
 | ||||||
| ### Events | ### Events | ||||||
|  | |||||||
| @ -20,6 +20,10 @@ export default createComponent({ | |||||||
|       type: Boolean, |       type: Boolean, | ||||||
|       default: true, |       default: true, | ||||||
|     }, |     }, | ||||||
|  |     showHeader: { | ||||||
|  |       type: Boolean, | ||||||
|  |       default: true, | ||||||
|  |     }, | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   data() { |   data() { | ||||||
| @ -180,18 +184,20 @@ export default createComponent({ | |||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     renderHeader() { |     renderHeader() { | ||||||
|       return ( |       if (this.showHeader) { | ||||||
|         <div class={bem('header')}> |         return ( | ||||||
|           <h2 class={bem('title')}>{this.slots('title') || this.title}</h2> |           <div class={bem('header')}> | ||||||
|           {this.closeable ? ( |             <h2 class={bem('title')}>{this.slots('title') || this.title}</h2> | ||||||
|             <Icon |             {this.closeable ? ( | ||||||
|               name="cross" |               <Icon | ||||||
|               class={bem('close-icon')} |                 name="cross" | ||||||
|               onClick={this.onClose} |                 class={bem('close-icon')} | ||||||
|             /> |                 onClick={this.onClose} | ||||||
|           ) : null} |               /> | ||||||
|         </div> |             ) : null} | ||||||
|       ); |           </div> | ||||||
|  |         ); | ||||||
|  |       } | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     renderOptions(options, selectedOption, tabIndex) { |     renderOptions(options, selectedOption, tabIndex) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user