@pit-front-end/components
Version:
湖南创智艾泰克科技有限公司
64 lines (63 loc) • 2.07 kB
JavaScript
import { defineComponent as f, inject as h, computed as c, resolveComponent as x, createBlock as y, openBlock as g, unref as w, isRef as C, createSlots as I, withCtx as p, renderSlot as a } from "vue";
import { isNullOrUnDef as b } from "../../../utils/is.js";
import { formContextKey as v } from "pit-element-plus";
import { inputEmits as B, inputProps as k } from "./input.js";
import { useInput as V } from "./use-input.js";
const W = /* @__PURE__ */ f({
name: "PitInput",
inheritAttrs: !1,
__name: "input",
props: k,
emits: B,
setup(s, { emit: o }) {
const e = s, t = h(v, void 0), { modelValue: l } = V(e), d = c(() => b(e.showWordLimit) ? !(t != null && t.isSearch) : e.showWordLimit), r = {
handleBlur(n) {
o("blur", n);
},
handleInput(n) {
o("input", n);
},
handleChange(n) {
o("change", n);
}
};
return (n, i) => {
const u = x("el-input");
return g(), y(u, {
modelValue: w(l),
"onUpdate:modelValue": i[0] || (i[0] = (m) => C(l) ? l.value = m : null),
clearable: e.clearable,
disabled: e.disabled,
maxlength: e.maxlength,
placeholder: e.placeholder,
"prefix-icon": e.prefixIcon,
readonly: e.readonly,
"show-word-limit": d.value,
size: e.size,
"suffix-icon": e.suffixIcon,
type: e.type,
onBlur: r.handleBlur,
onChange: r.handleChange,
onInput: r.handleInput
}, I({ _: 2 }, [
n.$slots.prepend ? {
name: "prepend",
fn: p(() => [
a(n.$slots, "prepend")
]),
key: "0"
} : void 0,
n.$slots.append ? {
name: "append",
fn: p(() => [
a(n.$slots, "append")
]),
key: "1"
} : void 0
]), 1032, ["modelValue", "clearable", "disabled", "maxlength", "placeholder", "prefix-icon", "readonly", "show-word-limit", "size", "suffix-icon", "type", "onBlur", "onChange", "onInput"]);
};
}
});
export {
W as default
};