vue-facing-decorator icon indicating copy to clipboard operation
vue-facing-decorator copied to clipboard

@Setup

Open nseb opened this issue 1 year ago • 1 comments
trafficstars

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 ?

nseb avatar Jun 12 '24 15:06 nseb

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.

J-Sek avatar Jul 05 '24 10:07 J-Sek