mirror of
				https://gitee.com/vant-contrib/vant.git
				synced 2025-10-27 01:32:10 +08:00 
			
		
		
		
	fix popup manager
This commit is contained in:
		
							parent
							
								
									24e1caca32
								
							
						
					
					
						commit
						c5d5c90c06
					
				| @ -2,19 +2,20 @@ import Vue from 'vue'; | ||||
| import merge from 'src/utils/merge'; | ||||
| import PopupManager from './popup-manager'; | ||||
| 
 | ||||
| let popupContext; | ||||
| let popupContext = { | ||||
|   idSeed: 1, | ||||
|   zIndex: 2000, | ||||
|   hasModal: false, | ||||
|   instances: {}, | ||||
|   modalStack: [] | ||||
| }; | ||||
| 
 | ||||
| if (Vue.prototype.$isServer) { | ||||
|   popupContext = global.popupContext || {}; | ||||
|   global.popupContext = popupContext; | ||||
| } else { | ||||
|   popupContext = window.popupContext || {}; | ||||
|   window.popupContext = popupContext; | ||||
| } | ||||
| 
 | ||||
| popupContext = merge(popupContext, { | ||||
|   idSeed: 1 | ||||
| }); | ||||
| 
 | ||||
| const getDOM = function(dom) { | ||||
|   if (dom.nodeType === 3) { | ||||
|     dom = dom.nextElementSibling || dom.nextSibling; | ||||
| @ -98,9 +99,9 @@ export default { | ||||
|       const props = merge({}, this, options); | ||||
|       const zIndex = props.zIndex; | ||||
| 
 | ||||
|       // 如果属性中传入了`zIndex`,则覆盖`PopupManager`中对应的`zIndex`
 | ||||
|       // 如果属性中传入了`zIndex`,则覆盖`popupContext`中对应的`zIndex`
 | ||||
|       if (zIndex) { | ||||
|         PopupManager.zIndex = zIndex; | ||||
|         popupContext.zIndex = zIndex; | ||||
|       } | ||||
| 
 | ||||
|       // 如果显示遮罩层
 | ||||
|  | ||||
| @ -1,22 +1,13 @@ | ||||
| import Vue from 'vue'; | ||||
| import merge from 'src/utils/merge'; | ||||
| import { addClass } from 'src/utils/dom'; | ||||
| 
 | ||||
| let popupContext; | ||||
| if (Vue.prototype.$isServer) { | ||||
|   popupContext = global.popupContext || {}; | ||||
|   global.popupContext = popupContext; | ||||
| } else { | ||||
|   popupContext = window.popupContext || {}; | ||||
|   window.popupContext = popupContext; | ||||
| } | ||||
| 
 | ||||
| popupContext = merge(popupContext, { | ||||
|   hasModal: false, | ||||
|   instances: {}, | ||||
|   modalStack: [] | ||||
| }); | ||||
| 
 | ||||
| const getModal = function() { | ||||
|   let modalDom = PopupManager.modalDom; | ||||
|   if (modalDom) { | ||||
| @ -40,10 +31,8 @@ const getModal = function() { | ||||
| }; | ||||
| 
 | ||||
| const PopupManager = { | ||||
|   zIndex: 2000, | ||||
| 
 | ||||
|   nextZIndex() { | ||||
|     return this.zIndex++; | ||||
|     return popupContext.zIndex++; | ||||
|   }, | ||||
| 
 | ||||
|   getInstance(id) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user