ksc-fe / kpc

A UI Components Library for Intact, Vue, React and Angular.
https://design.ksyun.com/
MIT License
365 stars 53 forks source link

【Vue】Upload双向绑定files(v-model:files),会导致死循环 #936

Closed Javey closed 6 months ago

Javey commented 11 months ago

CodeSandbox

Description

Javey commented 6 months ago

问题依然存在,因为vue会将files转成proxy对象,导致isEqualArray判断失效,可以采用vue的toRaw方法还原在比较

export function isProxy(value: any): boolean {
  return value ? !!value[ReactiveFlags.RAW] : false
}
export function toRaw<T>(observed: T): T {
  const raw = observed && (observed as Target)[ReactiveFlags.RAW]
  return raw ? toRaw(raw) : observed
}
Javey commented 6 months ago
ReactiveFlags.RAW = '__v_raw'