vue3 api不支持nextTick, 而nextTick是很常用的方法,我该怎么开发或用什么方法代替
 
                                        
                                    
                                    
                                        ICanHelp                                                                                
                                        
                                - 发布:2022-08-24 11:39
- 更新:2023-06-21 14:49
- 阅读:1121
vue3 api不支持nextTick
                                分类:uni-app
                            
                            
                            
                             
                                                                    
                                                                可以使用 getCurrentInstance 调用 $nextTick 方法
import { getCurrentInstance } from 'vue';  
export function useNextTick() {  
  const currentInstance = getCurrentInstance();  
  // vue3 api nextTick 小程序不支持  
  return async function nextTick(fn?: any) {  
    return currentInstance?.proxy?.$nextTick.call(currentInstance?.proxy, fn);  
  }  
} 
             
             
             
			 
                                                                     
                                                                     
            
ICanHelp (作者)
我在setup怎么调用$nextTick呢?
2022-09-09 09:43
CODE_XU
回复 ICanHelp: import { nextTick } from 'vue'
2022-09-09 10:20
ICanHelp (作者)
回复 CODE_XU: 但是微信小程序不支持
2022-09-10 15:27
cookUni
实测hbx3.8.6下app-nvue组件内使用无效
2023-07-06 12:02