UNPKG

ant-design-x-vue

Version:

Craft AI-driven interfaces effortlessly

22 lines (21 loc) 650 B
import { ref as o, unref as c, watchEffect as s, watch as g, toRaw as d } from "vue"; function m(l, t) { const { defaultValue: u, value: a = o() } = t || {}; let n = typeof l == "function" ? l() : l; a.value !== void 0 && (n = c(a)), u !== void 0 && (n = typeof u == "function" ? u() : u); const v = o(n), f = o(n); s(() => { let e = a.value !== void 0 ? a.value : v.value; t.postState && (e = t.postState(e)), f.value = e; }); function r(e) { const i = f.value; v.value = e, d(f.value) !== e && t.onChange && t.onChange(e, i); } return g(a, () => { v.value = a.value; }), [f, r]; } export { m as default };