mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 19:17:48 +00:00 
			
		
		
		
	 8e9b21820e
			
		
	
	8e9b21820e
	
	
	
		
			
			* feat: setup vuelitdate for vue 2.7 * feat: add all composables * feat: return track method --------- Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
		
			
				
	
	
		
			31 lines
		
	
	
		
			749 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			749 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import { getCurrentInstance, reactive, watchEffect } from 'vue';
 | |
| 
 | |
| /**
 | |
|  * Returns the current route location. Equivalent to using `$route` inside
 | |
|  * templates.
 | |
|  */
 | |
| export function useRoute() {
 | |
|   const instance = getCurrentInstance();
 | |
|   const route = reactive(Object.assign({}, instance.proxy.$root.$route));
 | |
|   watchEffect(() => {
 | |
|     Object.assign(route, instance.proxy.$root.$route);
 | |
|   });
 | |
| 
 | |
|   return route;
 | |
| }
 | |
| 
 | |
| /**
 | |
|  * Returns the router instance. Equivalent to using `$router` inside
 | |
|  * templates.
 | |
|  */
 | |
| export function useRouter() {
 | |
|   const instance = getCurrentInstance();
 | |
|   const router = instance.proxy.$root.$router;
 | |
|   watchEffect(() => {
 | |
|     if (router) {
 | |
|       Object.assign(router, instance.proxy.$root.$router);
 | |
|     }
 | |
|   });
 | |
|   return router;
 | |
| }
 |