You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							20 lines
						
					
					
						
							493 B
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							20 lines
						
					
					
						
							493 B
						
					
					
				
								import { createPinia } from 'pinia';
							 | 
						|
								import piniaPersist from 'pinia-plugin-persist-uni';
							 | 
						|
								
							 | 
						|
								// 自动注入所有pinia模块
							 | 
						|
								const files = import.meta.glob('./*.js', { eager: true });
							 | 
						|
								const modules = {};
							 | 
						|
								Object.keys(files).forEach((key) => {
							 | 
						|
								  modules[key.replace(/(.*\/)*([^.]+).*/gi, '$2')] = files[key].default;
							 | 
						|
								});
							 | 
						|
								
							 | 
						|
								export const setupPinia = (app) => {
							 | 
						|
								  const pinia = createPinia();
							 | 
						|
								  pinia.use(piniaPersist);
							 | 
						|
								
							 | 
						|
								  app.use(pinia);
							 | 
						|
								};
							 | 
						|
								
							 | 
						|
								export default (name) => {
							 | 
						|
								  return modules[name]();
							 | 
						|
								};
							 |