bms-shared-components 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/dist/bms-shared-components.js +4091 -4120
- package/dist/bms-shared-components.umd.cjs +93 -93
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -76,10 +76,12 @@ import { createPinia } from "pinia";
|
|
|
76
76
|
import { createBmsComponentsPlugin } from "bms-shared-components";
|
|
77
77
|
import "bms-shared-components/style.css";
|
|
78
78
|
|
|
79
|
-
const
|
|
79
|
+
const hostPinia = createPinia();
|
|
80
|
+
const libPinia = createPinia();
|
|
80
81
|
const app = createApp(App);
|
|
82
|
+
app.use(hostPinia); // pinia хоста
|
|
81
83
|
app.use(createBmsComponentsPlugin({
|
|
82
|
-
pinia,
|
|
84
|
+
pinia: libPinia, // отдельный pinia для библиотеки
|
|
83
85
|
axiosInstance: {
|
|
84
86
|
baseURL: "https://api.example.com",
|
|
85
87
|
headers: { Authorization: "Bearer your-jwt-token" },
|
|
@@ -88,4 +90,8 @@ app.use(createBmsComponentsPlugin({
|
|
|
88
90
|
app.mount("#app");
|
|
89
91
|
```
|
|
90
92
|
|
|
93
|
+
Плагин использует свой экземпляр Pinia через `provide`, без `app.use`. Хост и библиотека — разные экземпляры, данные не пересекаются.
|
|
94
|
+
|
|
95
|
+
**Синхронизация useUserStore с хостом:** после логина в хосте вызывайте `useUserStore(libPinia).setUser(user)` — передайте `libPinia` (pinia библиотеки).
|
|
96
|
+
|
|
91
97
|
Доступны глобально: `$setupAxios`, `$updateAxiosToken`.
|