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

@Setup #126

Open
nseb opened this issue Jun 12, 2024 · 1 comment
Open

@Setup #126

nseb opened this issue Jun 12, 2024 · 1 comment

Comments

@nseb
Copy link

nseb commented Jun 12, 2024

Hello,
I have a base component A(no template , only ts) , with @setup for inject my composable .
I have another component B extends my base component A (with template), the @ Setup not working.
If i move @ Setup in my my component B , it's works.

@ Setup works only with toNative ?

@J-Sek
Copy link

J-Sek commented Jul 5, 2024

I just bumped into this. My workaround for now is to declare @Setup twice. Once as private field (with _ prefix for the field name), and second as usual.

@Component({})
export class PageWithTour extends Vue {
  @Setup(() => useOnboarding()) private _onboarding!: ReturnType<typeof useOnboarding>;
  // ... use this._onboarding
}
@Component({})
class MyPage extends PageWithTour {
  @Setup(() => useOnboarding()) onboarding!: ReturnType<typeof useOnboarding>;
  // ... use this.onboarding
}

Works fine for sharing Pinia stores. Alternatively I could setup the store on the layout and @Provide it all the way down for any interested component.

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

2 participants