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

How to install in nuxt project? #4

Open
adibpwd opened this issue Aug 26, 2022 · 6 comments
Open

How to install in nuxt project? #4

adibpwd opened this issue Aug 26, 2022 · 6 comments

Comments

@adibpwd
Copy link

adibpwd commented Aug 26, 2022

I want use vuesax in nuxt, how to install it?

@lk77
Copy link
Owner

lk77 commented Sep 5, 2022

There is no option to install vuesax anymore in nuxt, and it was for old vuesax anyway, but i guess you can get inspiration from the old nuxt template :

https://github.com/nuxt/create-nuxt-app/tree/ed17e67e1499a69f9c6eb364c0df6b64cd5a2a19/packages/cna-template/template/frameworks/vuesax

it's for vue2, but i think the same principles apply for vue3 :

import Vuesax from 'vuesax3';
import 'vuesax3/dist/vuesax.css' ;

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(Vuesax)
})

and then you simply use the vuesax components in your pages/components

@yuyanghh
Copy link

yuyanghh commented Nov 8, 2023

@lk77 Thanks for the solution.
I've tried with nuxt ^3.8.1, vue ^3.3.8, and vuesax3 ^4.2.1, yet encountered a complain of type definition:

Argument of type '(app: any, options: any) => void' is not assignable to parameter of type 'Plugin<[]>'.
  Type '(app: any, options: any) => void' is not assignable to type '((app: App<any>) => any) & { install?: ((app: App<any>) => any) | undefined; }'.
    Type '(app: any, options: any) => void' is not assignable to type '(app: App<any>) => any'.
      Target signature provides too few arguments. Expected 2 or more, but got 1.ts(2345)

I had to edit the module declaration to make Vuesax working.

declare module "vuesax3" {
  export default function install(app: any): any
}

Not sure whether this modification is recommended...

@lk77
Copy link
Owner

lk77 commented Nov 8, 2023

@yuyanghh i guess i could do that :

declare module "vuesax3" {
  export default function install(app: any, options?:any): any
}

in the meantime i think you can do :

nuxtApp.vueApp.use(Vuesax, {})

it should not complain anymore

@yuyanghh
Copy link

Yes! The warning is gone! Thanks a lot!

@lk77
Copy link
Owner

lk77 commented Nov 16, 2023

@yuyanghh i published an alpha version https://www.npmjs.com/package/vuesax3/v/4.3.0-alpha.0 with the changes to index.d.ts among other things, could you try it and tell me if your issue is fixed without the {} ?

@yuyanghh
Copy link

yuyanghh commented Dec 5, 2023

@lk77 Thanks a lot for the update. It fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants