Skip to content

Instantly share code, notes, and snippets.

@Akryum
Akryum / reactiveUrlQuery.ts
Created July 10, 2024 14:12
Reactive Url Query read & write object that can be used in Nuxt and in several components at the same time
import { useUrlSearchParams as useVueUseUrlSearchParams } from '@vueuse/core'
const paramsInstances = new Map<string, ReturnType<typeof useVueUseUrlSearchParams>>()
export function useRouteQuery<T extends Record<string, any> = Record<string, any>>(key?: string) {
if (import.meta.server) {
return useRoute().query as T
}
const finalKey = key ?? window.location.pathname
@regenrek
regenrek / .cursorrules
Last active April 14, 2025 15:26
Cursorrule for Nuxt3 Typescript and Nuxt Ui
You have extensive expertise in Vue 3, Nuxt 3, TypeScript, Node.js, Vite, Vue Router, Pinia, VueUse, Nuxt UI, and Tailwind CSS. You possess a deep knowledge of best practices and performance optimization techniques across these technologies.
Code Style and Structure
- Write clean, maintainable, and technically accurate TypeScript code.
- Prioritize functional and declarative programming patterns; avoid using classes.
- Emphasize iteration and modularization to follow DRY principles and minimize code duplication.
- Prefer Composition API <script setup> style.
- Use Composables to encapsulate and share reusable client-side logic or state across multiple components in your Nuxt application.
Nuxt 3 Specifics