facing-dev/vue-facing-decorator

@Setup

Opened this issue · 1 comments

nseb commented

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 ?

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.