@pit-front-end/components
Version:
湖南创智艾泰克科技有限公司
51 lines (50 loc) • 1.54 kB
JavaScript
import { defineComponent as p, useSlots as m, resolveComponent as u, createBlock as c, openBlock as h, createSlots as f, renderList as b, unref as g, withCtx as C, renderSlot as _ } from "vue";
import { pit as v } from "@pit-front-end/utils";
import { positiveNumberEmits as V, positiveNumberProps as I } from "./positive-number.js";
const P = /* @__PURE__ */ p({
name: "PitPositiveNumber",
inheritAttrs: !1,
__name: "positive-number",
props: I,
emits: V,
setup(s, { emit: t }) {
const e = s, d = m(), l = {
handleInput(n) {
let o = v.formatFloat(
n,
e.decimal,
e.max,
e.min,
e.negative
);
e.rmNegative && (o = o == null ? void 0 : o.replace(/-/g, "")), t("update:modelValue", o), t("input", o);
},
handleChange(n) {
t("change", n);
}
};
return (n, o) => {
const i = u("el-input");
return h(), c(i, {
modelValue: e.modelValue,
"onUpdate:modelValue": o[0] || (o[0] = (a) => e.modelValue = a),
onInput: l.handleInput,
onChange: l.handleChange,
clearable: e.clearable,
readonly: e.readonly,
disabled: e.disabled,
placeholder: n.placeholder
}, f({ _: 2 }, [
b(g(d), (a, r) => ({
name: r,
fn: C(() => [
_(n.$slots, r)
])
}))
]), 1032, ["modelValue", "onInput", "onChange", "clearable", "readonly", "disabled", "placeholder"]);
};
}
});
export {
P as default
};