Skip to content

Commit

Permalink
feat: modify use-$x composable
Browse files Browse the repository at this point in the history
  • Loading branch information
annacv committed Mar 20, 2024
1 parent 3064c83 commit 20d2f90
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/x-components/src/composables/use-$x.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { getCurrentInstance } from 'vue';
import { XComponentAPI } from '../plugins';
import { useAliasApi } from './use-alias-api';
import { useXBus } from './use-x-bus';

/**
* Function which returns the `$x` object from the current component instance.
Expand All @@ -9,5 +10,8 @@ import { XComponentAPI } from '../plugins';
* @public
*/
export function use$x(): XComponentAPI {
return (getCurrentInstance()?.proxy as unknown as { $x: XComponentAPI }).$x;
const xAliasAPI = useAliasApi();
const xBusAPI = useXBus();
const $x = Object.assign(xAliasAPI, xBusAPI);
return $x;
}

0 comments on commit 20d2f90

Please sign in to comment.