ksc-fe / kpc

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

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

Closed Javey closed 5 months ago

Javey commented 10 months ago

CodeSandbox

Description

Javey commented 5 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 5 months ago
ReactiveFlags.RAW = '__v_raw'