pinia代码部分
家人们,有没有知道该怎么处理的啊,我试着把这段函数注释了,就能打包了,但是就是报错显示,
下面是报错的提示信息,
没有与此调用匹配的重载。
第 1 个重载(共 3 个),“(id: "dataStore", options: Omit<DefineStoreOptions<"dataStore", { xiaohu: string; userinfo: {}; asideWidth: string; tabList: { path: string; title: string; }[]; activeTab: string; }, {}, { handleAsideWidth(): void; getDefault(route: string): void; addTabs(tab: any): void; }>, "id">): StoreDefinition<...>”,出现以下错误。
类型“{ persist: { enabled: boolean; strategies: { storage: Storage; paths: string[]; }[]; }; state: () => { xiaohu: string; userinfo: {}; asideWidth: string; tabList: { path: string; title: string; }[]; activeTab: string; }; actions: { ...; }; getters: {}; }”的参数不能赋给类型“Omit<DefineStoreOptions<"dataStore", { xiaohu: string; userinfo: {}; asideWidth: string; tabList: { path: string; title: string; }[]; activeTab: string; }, {}, { handleAsideWidth(): void; getDefault(route: string): void; addTabs(tab: any): void; }>, "id">”的参数。
对象字面量只能指定已知属性,并且“persist”不在类型“Omit<DefineStoreOptions<"dataStore", { xiaohu: string; userinfo: {}; asideWidth: string; tabList: { path: string; title: string; }[]; activeTab: string; }, {}, { handleAsideWidth(): void; getDefault(route: string): void; addTabs(tab: any): void; }>, "id">”中。
第 2 个重载(共 3 个),“(id: "dataStore", storeSetup: () => unknown, options?: DefineSetupStoreOptions<"dataStore", _UnwrapAll<Pick<unknown, never>>, Pick<unknown, never>, Pick<unknown, never>> | undefined): StoreDefinition<...>”,出现以下错误。
类型“{ persist: { enabled: boolean; strategies: { storage: Storage; paths: string[]; }[]; }; state: () => { xiaohu: string; userinfo: {}; asideWidth: string; tabList: { path: string; title: string; }[]; activeTab: string; }; actions: { ...; }; getters: {}; }”的参数不能赋给类型“() => unknown”的参数。
对象字面量只能指定已知属性,并且“persist”不在类型“() => unknown”中。ts(2769)
(property) persist: {
enabled: boolean;
strategies: {
storage: Storage;
paths: string[];
}[];
}
下面是将里面的代码部分注释掉了,还是会报这个错误的情况**
没有与此调用匹配的重载。
第 1 个重载(共 3 个),“(id: "dataStore", options: Omit<DefineStoreOptions<"dataStore", { xiaohu: string; userinfo: {}; asideWidth: string; tabList: { path: string; title: string; }[]; activeTab: string; }, {}, { handleAsideWidth(): void; getDefault(route: string): void; addTabs(tab: any): void; }>, "id">): StoreDefinition<...>”,出现以下错误。
类型“{ persist: {}; state: () => { xiaohu: string; userinfo: {}; asideWidth: string; tabList: { path: string; title: string; }[]; activeTab: string; }; actions: { handleAsideWidth(): void; getDefault(route: string): void; addTabs(tab: any): void; }; getters: {}; }”的参数不能赋给类型“Omit<DefineStoreOptions<"dataStore", { xiaohu: string; userinfo: {}; asideWidth: string; tabList: { path: string; title: string; }[]; activeTab: string; }, {}, { handleAsideWidth(): void; getDefault(route: string): void; addTabs(tab: any): void; }>, "id">”的参数。
对象字面量只能指定已知属性,并且“persist”不在类型“Omit<DefineStoreOptions<"dataStore", { xiaohu: string; userinfo: {}; asideWidth: string; tabList: { path: string; title: string; }[]; activeTab: string; }, {}, { handleAsideWidth(): void; getDefault(route: string): void; addTabs(tab: any): void; }>, "id">”中。
第 2 个重载(共 3 个),“(id: "dataStore", storeSetup: () => unknown, options?: DefineSetupStoreOptions<"dataStore", _UnwrapAll<Pick<unknown, never>>, Pick<unknown, never>, Pick<unknown, never>> | undefined): StoreDefinition<...>”,出现以下错误。
类型“{ persist: {}; state: () => { xiaohu: string; userinfo: {}; asideWidth: string; tabList: { path: string; title: string; }[]; activeTab: string; }; actions: { handleAsideWidth(): void; getDefault(route: string): void; addTabs(tab: any): void; }; getters: {}; }”的参数不能赋给类型“() => unknown”的参数。
对象字面量只能指定已知属性,并且“persist”不在类型“() => unknown”中。ts(2769)
成功了!
时隔多日,突然又看到了有人回复我这个问题,然后把持久化插件(pinia-plugin-persist)卸载了,配置也删了,安装了pinia-plugin-persistedstate,这个插件配置好,就可以了。下面是没有报错,并且打包成功的截图!!!