https://github.com/carodriguezg/primevue-mandatory
Vue directive for avoiding PrimeVue Listbox component to set a null value when an option is already selected.
https://github.com/carodriguezg/primevue-mandatory
directive mandatory nuxt nuxt3 primevue vue vue3
Last synced: 4 months ago
JSON representation
Vue directive for avoiding PrimeVue Listbox component to set a null value when an option is already selected.
- Host: GitHub
- URL: https://github.com/carodriguezg/primevue-mandatory
- Owner: CARodriguezG
- Created: 2025-03-09T21:19:16.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-10T21:43:41.000Z (over 1 year ago)
- Last Synced: 2025-03-29T16:03:07.419Z (about 1 year ago)
- Topics: directive, mandatory, nuxt, nuxt3, primevue, vue, vue3
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@carodriguezg/primevue-mandatory
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Project description
Vue directive for avoiding PrimeVue Listbox component to set a null value when an option is already selected.
**WARNING: This directive has only been test on Listbox PrimeVue component, but it should work on components which use the `updateModel` method to update their model.**
### Nuxt 3 Usage
1. Create a plugin in [nuxt plugins folder](https://nuxt.com/docs/guide/directory-structure/plugins).
2. Add the following code to install the directive:
```typescript
import PrimeVueMandatory from '@carodriguezg/primevue-mandatory'
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(PrimeVueMandatory)
})
```
3. Add `v-mandatory` on the component:
```html
```
4. Enjoy!