Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Vue plugins system #231

Merged
merged 7 commits into from
Dec 29, 2023
Merged

feat: Vue plugins system #231

merged 7 commits into from
Dec 29, 2023

Conversation

ojvribeiro
Copy link
Owner

@ojvribeiro ojvribeiro commented Sep 15, 2023

Resolves #13


This PR introduces a new function, definePlugin, which allows access to the .use() method of the Vue instance used by Vulmix. This enables the registration of any Vue plugin that requires app-level access, such as Vuetify or ApexCharts, which register components globally.

Usage

All you need to do is install the plugin following its documentation. Then, create a new plugin file (it can be a .js or .ts file) inside the /plugins folder.

In this case, we'll use Vuetify as an example (Vuetify docs):

npm install vuetify
// plugins/vuetify.js

import 'vuetify/styles'
import { createVuetify } from 'vuetify'
import * as components from 'vuetify/components'
import * as directives from 'vuetify/directives'

const vuetify = createVuetify({
  components,
  directives,
})

export default definePlugin((app) => {
  app.use(vuetify)
})

Note
The definePlugin function is auto-imported. 😄

And that's it! You can now use Vuetify components in your Vulmix app:

<template>
  <v-switch label="Switch"></v-switch>
</template>

image

@ojvribeiro ojvribeiro added the enhancement New feature or request label Sep 15, 2023
@ojvribeiro ojvribeiro added this to the 0.7.0 milestone Sep 15, 2023
@ojvribeiro ojvribeiro self-assigned this Sep 15, 2023
@ojvribeiro ojvribeiro linked an issue Sep 15, 2023 that may be closed by this pull request
@ojvribeiro ojvribeiro marked this pull request as ready for review September 15, 2023 07:42
@ojvribeiro ojvribeiro merged commit 5fcd18b into main Dec 29, 2023
@ojvribeiro ojvribeiro deleted the feat/vue-app-use branch December 29, 2023 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify the use of UI frameworks
1 participant