fix: prevented routes duplicates du to i18n
This commit is contained in:
		
							parent
							
								
									d50cbf263c
								
							
						
					
					
						commit
						55a1d130a0
					
				| @ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||||||
| 
 | 
 | ||||||
| ### Added | ### Added | ||||||
| - Added [/how-to-report-bug-or-request](/how-to-report-bug-or-request) route to explain how to report bug and request features | - Added [/how-to-report-bug-or-request](/how-to-report-bug-or-request) route to explain how to report bug and request features | ||||||
|  | - Added i18n support | ||||||
| 
 | 
 | ||||||
| ## 1.7.0 | ## 1.7.0 | ||||||
| - [feat] [Crontab friendly generator](https://it-tools.tech/crontab-generator) | - [feat] [Crontab friendly generator](https://it-tools.tech/crontab-generator) | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ export class ToolRoutesMixin extends Vue { | |||||||
|   toolRoutesSections : {[key: string]: ToolRouteConfig[]} = {} |   toolRoutesSections : {[key: string]: ToolRouteConfig[]} = {} | ||||||
| 
 | 
 | ||||||
|   async created() { |   async created() { | ||||||
|     const routes = this.$router.options.routes?.filter(r => r.meta?.isTool) || [] |     const routes = this.$router.options.routes?.filter((r1, i, a) => r1.meta?.isTool && a.findIndex(r2 => r2.path.split('/').pop() === r1.path.split('/').pop()) === i) || [] | ||||||
|     const flat: ToolRouteConfig[] = [] |     const flat: ToolRouteConfig[] = [] | ||||||
|     const sections: { [key: string]: ToolRouteConfig[] } = {} |     const sections: { [key: string]: ToolRouteConfig[] } = {} | ||||||
| 
 | 
 | ||||||
| @ -17,6 +17,7 @@ export class ToolRoutesMixin extends Vue { | |||||||
|       if ('component' in route) { |       if ('component' in route) { | ||||||
|         // @ts-ignore
 |         // @ts-ignore
 | ||||||
|         const component = await route.component() |         const component = await route.component() | ||||||
|  | 
 | ||||||
|         const routeConfig = {...route, config: component.options.methods.config()} as ToolRouteConfig |         const routeConfig = {...route, config: component.options.methods.config()} as ToolRouteConfig | ||||||
|         flat.push(routeConfig) |         flat.push(routeConfig) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -83,7 +83,9 @@ export default { | |||||||
| 
 | 
 | ||||||
|   i18n: { |   i18n: { | ||||||
|     vueI18nLoader: true, |     vueI18nLoader: true, | ||||||
|     locales: ['en'] |     locales: ['en'], | ||||||
|  |     defaultLocale: 'en', | ||||||
|  |     strategy: 'prefix_and_default' | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   // Build Configuration (https://go.nuxtjs.dev/config-build)
 |   // Build Configuration (https://go.nuxtjs.dev/config-build)
 | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ | |||||||
|     <v-col cols="12" sm="12" md="12"> |     <v-col cols="12" sm="12" md="12"> | ||||||
|       <h1>Yolo</h1> |       <h1>Yolo</h1> | ||||||
| 
 | 
 | ||||||
|       <v-row justify="center"> |       <v-row> | ||||||
|         <v-col |         <v-col | ||||||
|           v-for="(items, section) in toolRoutesSections" |           v-for="(items, section) in toolRoutesSections" | ||||||
|           :key="section" |           :key="section" | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user