fix: confirm throw error & renderEmpty error
							parent
							
								
									df83968de4
								
							
						
					
					
						commit
						d7c4377551
					
				|  | @ -1 +1 @@ | ||||||
| Subproject commit 51cd1e3aea790432b220a7233ba189899438f031 | Subproject commit 568de59ace46dcb555a5728153f69482b2732515 | ||||||
|  | @ -25,7 +25,7 @@ describe('ConfigProvider', () => { | ||||||
|         ); |         ); | ||||||
|       }, |       }, | ||||||
|     }); |     }); | ||||||
|     expect(wrapper.find({ name: 'Wave' }).vm.csp).toBe(csp); |     expect(wrapper.findComponent('Wave').vm.csp).toBe(csp); | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   it('autoInsertSpaceInButton', () => { |   it('autoInsertSpaceInButton', () => { | ||||||
|  | @ -39,6 +39,6 @@ describe('ConfigProvider', () => { | ||||||
|       }, |       }, | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     expect(wrapper.find({ name: 'AButton' }).text()).toBe('确定'); |     expect(wrapper.findComponent('AButton').text()).toBe('确定'); | ||||||
|   }); |   }); | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  | @ -27,18 +27,13 @@ const ConfigProvider = { | ||||||
|     pageHeader: PropTypes.object, |     pageHeader: PropTypes.object, | ||||||
|     transformCellText: PropTypes.func, |     transformCellText: PropTypes.func, | ||||||
|   }, |   }, | ||||||
|   setup(props) { |  | ||||||
|     const configProvider = reactive({ |  | ||||||
|       ...props, |  | ||||||
|       getPrefixCls: undefined, |  | ||||||
|       renderEmpty: undefined, |  | ||||||
|     }); |  | ||||||
|     provide('configProvider', configProvider); |  | ||||||
|     return { configProvider }; |  | ||||||
|   }, |  | ||||||
|   created() { |   created() { | ||||||
|     this.configProvider.getPrefixCls = this.getPrefixCls; |     this.configProvider = reactive({ | ||||||
|     this.configProvider.renderEmpty = this.renderEmpty; |       ...this.$props, | ||||||
|  |       getPrefixCls: this.getPrefixCls, | ||||||
|  |       renderEmpty: this.renderEmptyComponent, | ||||||
|  |     }); | ||||||
|  |     provide('configProvider', this.configProvider); | ||||||
|   }, |   }, | ||||||
|   watch: { |   watch: { | ||||||
|     ...getWatch([ |     ...getWatch([ | ||||||
|  |  | ||||||
|  | @ -46,13 +46,10 @@ const LocaleProvider = { | ||||||
|       }, |       }, | ||||||
|     }; |     }; | ||||||
|   }, |   }, | ||||||
|   created() { |  | ||||||
|     provide('localeData', this.$data); |  | ||||||
|   }, |  | ||||||
|   watch: { |   watch: { | ||||||
|     locale(val) { |     locale(val) { | ||||||
|       this.antLocale = { |       this.antLocale = { | ||||||
|         ...this.locale, |         ...val, | ||||||
|         exist: true, |         exist: true, | ||||||
|       }; |       }; | ||||||
|       setMomentLocale(val); |       setMomentLocale(val); | ||||||
|  | @ -60,6 +57,7 @@ const LocaleProvider = { | ||||||
|     }, |     }, | ||||||
|   }, |   }, | ||||||
|   created() { |   created() { | ||||||
|  |     provide('localeData', this.$data); | ||||||
|     const { locale } = this; |     const { locale } = this; | ||||||
|     setMomentLocale(locale); |     setMomentLocale(locale); | ||||||
|     changeConfirmLocale(locale && locale.Modal); |     changeConfirmLocale(locale && locale.Modal); | ||||||
|  |  | ||||||
|  | @ -6,8 +6,6 @@ import Omit from 'omit.js'; | ||||||
| 
 | 
 | ||||||
| export default function confirm(config) { | export default function confirm(config) { | ||||||
|   const div = document.createElement('div'); |   const div = document.createElement('div'); | ||||||
|   const el = document.createElement('div'); |  | ||||||
|   div.appendChild(el); |  | ||||||
|   document.body.appendChild(div); |   document.body.appendChild(div); | ||||||
|   let currentConfig = { ...Omit(config, ['parentContext']), close, visible: true }; |   let currentConfig = { ...Omit(config, ['parentContext']), close, visible: true }; | ||||||
| 
 | 
 | ||||||
|  | @ -25,7 +23,7 @@ export default function confirm(config) { | ||||||
|   } |   } | ||||||
|   function destroy(...args) { |   function destroy(...args) { | ||||||
|     if (confirmDialogInstance && div.parentNode) { |     if (confirmDialogInstance && div.parentNode) { | ||||||
|       confirmDialogInstance.unmount(div); |       confirmDialogInstance.vIf = false; // hack destroy
 | ||||||
|       confirmDialogInstance = null; |       confirmDialogInstance = null; | ||||||
|       div.parentNode.removeChild(div); |       div.parentNode.removeChild(div); | ||||||
|     } |     } | ||||||
|  | @ -47,14 +45,14 @@ export default function confirm(config) { | ||||||
|     return createApp({ |     return createApp({ | ||||||
|       parent: config.parentContext, |       parent: config.parentContext, | ||||||
|       data() { |       data() { | ||||||
|         return { confirmDialogProps }; |         return { confirmDialogProps, vIf: true }; | ||||||
|       }, |       }, | ||||||
|       render() { |       render() { | ||||||
|         // 先解构,避免报错,原因不详
 |         // 先解构,避免报错,原因不详
 | ||||||
|         const cdProps = { ...this.confirmDialogProps }; |         const cdProps = { ...this.confirmDialogProps }; | ||||||
|         return <ConfirmDialog {...cdProps} />; |         return this.vIf ? <ConfirmDialog {...cdProps} /> : null; | ||||||
|       }, |       }, | ||||||
|     }).mount(el); |     }).mount(div); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   confirmDialogInstance = render(currentConfig); |   confirmDialogInstance = render(currentConfig); | ||||||
|  |  | ||||||
|  | @ -45,7 +45,6 @@ import './transfer/style'; | ||||||
| import './tree/style'; | import './tree/style'; | ||||||
| import './upload/style'; | import './upload/style'; | ||||||
| import './layout/style'; | import './layout/style'; | ||||||
| import './form/style'; |  | ||||||
| import './anchor/style'; | import './anchor/style'; | ||||||
| import './list/style'; | import './list/style'; | ||||||
| import './carousel/style'; | import './carousel/style'; | ||||||
|  | @ -59,5 +58,5 @@ import './statistic/style'; | ||||||
| import './result/style'; | import './result/style'; | ||||||
| import './descriptions/style'; | import './descriptions/style'; | ||||||
| import './page-header/style'; | import './page-header/style'; | ||||||
| import './form-model/style'; | import './form/style'; | ||||||
| // import './color-picker/style';
 | // import './color-picker/style';
 | ||||||
|  |  | ||||||
|  | @ -4,7 +4,7 @@ | ||||||
|   </div> |   </div> | ||||||
| </template> | </template> | ||||||
| <script> | <script> | ||||||
| import demo from '../antdv-demo/docs/comment/demo/index'; | import demo from '../antdv-demo/docs/config-provider/demo/index'; | ||||||
| 
 | 
 | ||||||
| export default { | export default { | ||||||
|   components: { |   components: { | ||||||
|  |  | ||||||
|  | @ -103,7 +103,16 @@ module.exports = { | ||||||
|   }, |   }, | ||||||
|   resolve: { |   resolve: { | ||||||
|     alias: { |     alias: { | ||||||
|  |       'ant-design-vue/es/locale/en_US': path.join( | ||||||
|  |         __dirname, | ||||||
|  |         './components/locale-provider/en_US.js', | ||||||
|  |       ), | ||||||
|  |       'ant-design-vue/es/locale/zh_CN': path.join( | ||||||
|  |         __dirname, | ||||||
|  |         './components/locale-provider/zh_CN.js', | ||||||
|  |       ), | ||||||
|       'ant-design-vue': path.join(__dirname, './components'), |       'ant-design-vue': path.join(__dirname, './components'), | ||||||
|  | 
 | ||||||
|       // vue$: 'vue/dist/vue.esm.js',
 |       // vue$: 'vue/dist/vue.esm.js',
 | ||||||
|     }, |     }, | ||||||
|     extensions: ['.js', '.jsx', '.vue', '.md'], |     extensions: ['.js', '.jsx', '.vue', '.md'], | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 tanjinzhou
						tanjinzhou