Commit 996f4b87b09a7d424371fe263300fc962b4a6924
1 parent
0e80ddda
fix(src/store): 修改tab切换websocket控制台报错
Showing
1 changed file
with
26 additions
and
4 deletions
... | ... | @@ -69,10 +69,17 @@ export const useSocketStore = defineStore({ |
69 | 69 | }) |
70 | 70 | } else { |
71 | 71 | const keysRecord: Record<string, KeyBoundComponentList[]> = {} |
72 | - | |
73 | - keys.forEach(key => { | |
72 | + /**这里修改自定义tab切换传的单个属性问题 | |
73 | + * ft | |
74 | + * 源代码 keys.forEach | |
75 | + * 修改代码 const overrideKeys = typeof keys==="string"?[keys]: keys overrideKeys.forEach | |
76 | + */ | |
77 | + const overrideKeys = typeof keys==="string"?[keys]: keys | |
78 | + | |
79 | + overrideKeys.forEach(key => { | |
74 | 80 | Reflect.set(keysRecord, key, [{ componentId }]) |
75 | 81 | }) |
82 | + //ft | |
76 | 83 | Reflect.set(this.connectionPool, entityId, keysRecord) |
77 | 84 | } |
78 | 85 | return this.refreshSubscribedMessage(entityId) |
... | ... | @@ -177,15 +184,22 @@ export const useSocketStore = defineStore({ |
177 | 184 | */ |
178 | 185 | getNeedUpdateComponentsIdBySubscribeId(subscribeId: number, keys: string[]) { |
179 | 186 | const entityId = this.subscribePool.find(item => item.subscribeId === subscribeId)?.entityId |
187 | + /**这里修改自定义tab切换传的单个属性问题 | |
188 | + * ft | |
189 | + * 源代码 keys.map(key => keysRecord[key]) | |
190 | + * 修改代码 const overrideKeys = typeof keys==="string"?[keys]: keys overrideKeys.map(key => keysRecord[key]) | |
191 | + */ | |
192 | + const overrideKeys = typeof keys==="string"?[keys]: keys | |
180 | 193 | |
181 | 194 | if (entityId) { |
182 | 195 | const keysRecord = Reflect.get(this.connectionPool, entityId) |
183 | - const needUpdateComponents = keys.map(key => keysRecord[key]) | |
196 | + const needUpdateComponents = overrideKeys.map(key => keysRecord[key]) | |
184 | 197 | const ids = needUpdateComponents |
185 | 198 | .reduce((prev, next) => [...prev, ...next], []) |
186 | 199 | .map((item: KeyBoundComponentList) => item.componentId) |
187 | 200 | return [...new Set(ids)] |
188 | 201 | } |
202 | + //ft | |
189 | 203 | }, |
190 | 204 | |
191 | 205 | /** |
... | ... | @@ -198,7 +212,15 @@ export const useSocketStore = defineStore({ |
198 | 212 | const { request: { requestParams } } = targetComponent |
199 | 213 | const { Params } = requestParams |
200 | 214 | const { keys = [] } = Params |
201 | - const targetComponentBindKeys = keys as unknown as string[] | |
215 | + /**这里修改自定义tab切换传的单个属性问题 | |
216 | + * ft | |
217 | + * 源代码 keys as unknown as string[] | |
218 | + * 修改代码 const overrideKeys = typeof keys==="string"?[keys]: keys overrideKeys as unknown as string[] | |
219 | + */ | |
220 | + const overrideKeys = typeof keys==="string"?[keys]: keys | |
221 | + | |
222 | + const targetComponentBindKeys = overrideKeys as unknown as string[] | |
223 | + //ft | |
202 | 224 | |
203 | 225 | const _value = cloneDeep(value) || { data: {}, latestValues: {} } |
204 | 226 | _value.data = targetComponentBindKeys.reduce((prev, next) => { | ... | ... |