perf: remove syncWatch
							parent
							
								
									7719c65169
								
							
						
					
					
						commit
						122e374224
					
				|  | @ -2,7 +2,6 @@ import PropTypes from './vue-types'; | |||
| import switchScrollingEffect from './switchScrollingEffect'; | ||||
| import setStyle from './setStyle'; | ||||
| import Portal from './Portal'; | ||||
| import syncWatch from './syncWatch'; | ||||
| 
 | ||||
| let openCount = 0; | ||||
| const windowIsUndefined = !( | ||||
|  | @ -33,9 +32,9 @@ export default { | |||
|     this.setWrapperClassName(); | ||||
|   }, | ||||
|   watch: { | ||||
|     visible: syncWatch(function(val) { | ||||
|     visible(val) { | ||||
|       openCount = val ? openCount + 1 : openCount - 1; | ||||
|     }), | ||||
|     }, | ||||
|     getContainer(getContainer, prevGetContainer) { | ||||
|       const getContainerIsFunc = | ||||
|         typeof getContainer === 'function' && typeof prevGetContainer === 'function'; | ||||
|  |  | |||
|  | @ -1,6 +0,0 @@ | |||
| export default function syncWatch(fn) { | ||||
|   return { | ||||
|     handler: fn, | ||||
|     flush: 'sync', | ||||
|   }; | ||||
| } | ||||
|  | @ -5,7 +5,6 @@ import omit from 'omit.js'; | |||
| import { cloneElement } from '../_util/vnode'; | ||||
| import { ConfigConsumerProps } from '../config-provider'; | ||||
| import { inject } from 'vue'; | ||||
| import syncWatch from '../_util/syncWatch'; | ||||
| 
 | ||||
| function getNumberArray(num) { | ||||
|   return num | ||||
|  | @ -47,12 +46,12 @@ export default { | |||
|     }; | ||||
|   }, | ||||
|   watch: { | ||||
|     count: syncWatch(function() { | ||||
|     count() { | ||||
|       this.lastCount = this.sCount; | ||||
|       this.setState({ | ||||
|         animateStarted: true, | ||||
|       }); | ||||
|     }), | ||||
|     }, | ||||
|   }, | ||||
|   updated() { | ||||
|     const { animateStarted, count } = this; | ||||
|  |  | |||
|  | @ -6,7 +6,6 @@ import inputProps from './inputProps'; | |||
| import { hasProp, getComponent, getOptionProps } from '../_util/props-util'; | ||||
| import { ConfigConsumerProps } from '../config-provider'; | ||||
| import ClearableLabeledInput from './ClearableLabeledInput'; | ||||
| import syncWatch from '../_util/syncWatch'; | ||||
| 
 | ||||
| export function fixControlledValue(value) { | ||||
|   if (typeof value === 'undefined' || value === null) { | ||||
|  | @ -68,9 +67,9 @@ export default { | |||
|     }; | ||||
|   }, | ||||
|   watch: { | ||||
|     value: syncWatch(function(val) { | ||||
|     value(val) { | ||||
|       this.stateValue = val; | ||||
|     }), | ||||
|     }, | ||||
|   }, | ||||
|   mounted() { | ||||
|     this.$nextTick(() => { | ||||
|  |  | |||
|  | @ -8,7 +8,6 @@ import BaseMixin from '../_util/BaseMixin'; | |||
| import inputProps from './inputProps'; | ||||
| import PropTypes from '../_util/vue-types'; | ||||
| import { getOptionProps } from '../_util/props-util'; | ||||
| import syncWatch from '../_util/syncWatch'; | ||||
| 
 | ||||
| const RESIZE_STATUS_NONE = 0; | ||||
| const RESIZE_STATUS_RESIZING = 1; | ||||
|  | @ -39,11 +38,11 @@ const ResizableTextArea = { | |||
|     raf.cancel(this.resizeFrameId); | ||||
|   }, | ||||
|   watch: { | ||||
|     value: syncWatch(function() { | ||||
|     value() { | ||||
|       this.$nextTick(() => { | ||||
|         this.resizeTextarea(); | ||||
|       }); | ||||
|     }), | ||||
|     }, | ||||
|   }, | ||||
|   methods: { | ||||
|     saveTextArea(textArea) { | ||||
|  |  | |||
|  | @ -6,7 +6,6 @@ import { hasProp, getOptionProps } from '../_util/props-util'; | |||
| import { ConfigConsumerProps } from '../config-provider'; | ||||
| import { fixControlledValue, resolveOnChange } from './Input'; | ||||
| import PropTypes from '../_util/vue-types'; | ||||
| import syncWatch from '../_util/syncWatch'; | ||||
| 
 | ||||
| const TextAreaProps = { | ||||
|   ...inputProps, | ||||
|  | @ -32,9 +31,9 @@ export default { | |||
|     }; | ||||
|   }, | ||||
|   watch: { | ||||
|     value: syncWatch(function(val) { | ||||
|     value(val) { | ||||
|       this.stateValue = val; | ||||
|     }), | ||||
|     }, | ||||
|   }, | ||||
|   mounted() { | ||||
|     this.$nextTick(() => { | ||||
|  |  | |||
|  | @ -11,7 +11,6 @@ const ButtonType = buttonTypes().type; | |||
| import LocaleReceiver from '../locale-provider/LocaleReceiver'; | ||||
| import { initDefaultProps, getComponent, getSlot } from '../_util/props-util'; | ||||
| import { ConfigConsumerProps } from '../config-provider'; | ||||
| import syncWatch from '../_util/syncWatch'; | ||||
| 
 | ||||
| let mousePosition = null; | ||||
| // ref: https://github.com/ant-design/ant-design/issues/15795 | ||||
|  | @ -107,9 +106,9 @@ export default { | |||
|     }; | ||||
|   }, | ||||
|   watch: { | ||||
|     visible: syncWatch(function(val) { | ||||
|     visible(val) { | ||||
|       this.sVisible = val; | ||||
|     }), | ||||
|     }, | ||||
|   }, | ||||
|   setup() { | ||||
|     return { | ||||
|  |  | |||
|  | @ -8,7 +8,6 @@ import shallowEqualArrays from 'shallow-equal/arrays'; | |||
| import { hasProp, getEvents } from '../_util/props-util'; | ||||
| import BaseMixin from '../_util/BaseMixin'; | ||||
| import { cloneElement } from '../_util/vnode'; | ||||
| import syncWatch from '../_util/syncWatch'; | ||||
| 
 | ||||
| const BUILT_IN_PLACEMENTS = { | ||||
|   bottomLeft: { | ||||
|  | @ -100,7 +99,7 @@ export default { | |||
|     }; | ||||
|   }, | ||||
|   watch: { | ||||
|     value: syncWatch(function(val, oldValue) { | ||||
|     value(val, oldValue) { | ||||
|       if (!shallowEqualArrays(val, oldValue)) { | ||||
|         const newValues = { | ||||
|           sValue: val || [], | ||||
|  | @ -112,12 +111,12 @@ export default { | |||
|         } | ||||
|         this.setState(newValues); | ||||
|       } | ||||
|     }), | ||||
|     popupVisible: syncWatch(function(val) { | ||||
|     }, | ||||
|     popupVisible(val) { | ||||
|       this.setState({ | ||||
|         sPopupVisible: val, | ||||
|       }); | ||||
|     }), | ||||
|     }, | ||||
|   }, | ||||
|   methods: { | ||||
|     getPopupDOMNode() { | ||||
|  |  | |||
|  | @ -15,7 +15,6 @@ import BodyTable from './BodyTable'; | |||
| import ExpandableTable from './ExpandableTable'; | ||||
| import { initDefaultProps, getOptionProps } from '../../_util/props-util'; | ||||
| import BaseMixin from '../../_util/BaseMixin'; | ||||
| import syncWatch from '../../_util/syncWatch'; | ||||
| 
 | ||||
| export default { | ||||
|   name: 'Table', | ||||
|  | @ -129,11 +128,11 @@ export default { | |||
|         this.components, | ||||
|       ); | ||||
|     }, | ||||
|     columns: syncWatch(function(val) { | ||||
|     columns(val) { | ||||
|       if (val) { | ||||
|         this.columnManager.reset(val); | ||||
|       } | ||||
|     }), | ||||
|     }, | ||||
|     data(val) { | ||||
|       if (val.length === 0 && this.hasScrollX()) { | ||||
|         this.$nextTick(() => { | ||||
|  |  | |||
|  | @ -4,7 +4,6 @@ import warning from 'warning'; | |||
| import { hasProp, initDefaultProps, getOptionProps, getSlot } from '../../_util/props-util'; | ||||
| import { cloneElement } from '../../_util/vnode'; | ||||
| import BaseMixin from '../../_util/BaseMixin'; | ||||
| import syncWatch from '../../_util/syncWatch'; | ||||
| import { | ||||
|   convertTreeToEntities, | ||||
|   convertDataToTree, | ||||
|  | @ -153,10 +152,10 @@ const Tree = { | |||
|       'checkedKeys', | ||||
|       'loadedKeys', | ||||
|     ]), | ||||
|     __propsSymbol__: syncWatch(function() { | ||||
|     __propsSymbol__() { | ||||
|       this.setState(this.getDerivedState(getOptionProps(this), this.$data)); | ||||
|       this.needSyncKeys = {}; | ||||
|     }), | ||||
|     }, | ||||
|   }, | ||||
| 
 | ||||
|   methods: { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 tangjinzhou
						tangjinzhou