@artmate/chat
Version:
借鉴字节开源react库AntX,通过vue实现的版本
32 lines (31 loc) • 520 B
JavaScript
import { watch as c, ref as m } from "vue";
function y(o, t) {
let n;
c(
() => t,
() => {
n = (e) => typeof t == "function" ? t(e) : t ? t[e.role] || {} : {};
},
{
immediate: !0
}
);
const i = m([]), a = (e) => {
const u = (e || []).map((r, f) => {
const s = r.key ?? `preset_${f}`;
return {
...n(r),
...r,
key: s
};
});
i.value = u;
};
return a(o), {
ListData: i,
setListData: a
};
}
export {
y as default
};