1/5/1404
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
import { defineComponent, computed, mergeProps, unref, createSlots, withCtx, renderSlot, useSSRContext } from 'vue';
|
||||
import { ssrRenderAttrs, ssrInterpolate, ssrRenderComponent, ssrRenderSlot } from 'vue/server-renderer';
|
||||
import { u as usePrice } from './usePrice-B-5-jXKQ.mjs';
|
||||
import { u as usePrefix } from './BasicIconOld-I4c2ShMu.mjs';
|
||||
import { _ as __nuxt_component_0, I as Input } from './index--Q-kfs0Q.mjs';
|
||||
|
||||
const _sfc_main = /* @__PURE__ */ defineComponent({
|
||||
__name: "BasicInput",
|
||||
__ssrInlineRender: true,
|
||||
props: {
|
||||
title: {},
|
||||
value: {},
|
||||
size: {},
|
||||
type: {},
|
||||
isPassword: { type: Boolean, default: false },
|
||||
inputmode: {},
|
||||
disabled: { type: Boolean },
|
||||
addonAfter: {},
|
||||
addonBefore: {},
|
||||
addonBgColor: {},
|
||||
addonTextColor: {},
|
||||
placeHolder: {}
|
||||
},
|
||||
emits: ["update:value", "onchange"],
|
||||
setup(__props, { emit: __emit }) {
|
||||
computed(() => props.addonBgColor);
|
||||
computed(() => props.addonTextColor);
|
||||
const localValue = computed({
|
||||
set(value) {
|
||||
props.type === "price" ? emits("update:value", value == null ? void 0 : value.toString().replaceAll(",", "")) : emits("update:value", value);
|
||||
},
|
||||
get() {
|
||||
let a = props.type === "price" ? props.value ? usePrice(props.value, true, "").trim() : "" : props.value;
|
||||
return a;
|
||||
}
|
||||
});
|
||||
const props = __props;
|
||||
const emits = __emit;
|
||||
const handlerChange = (e) => {
|
||||
var _a, _b;
|
||||
props.type === "price" ? emits("update:value", (_a = e.target.value) == null ? void 0 : _a.toString().replaceAll(",", "")) : emits("update:value", e.target.value);
|
||||
props.type === "price" ? emits("onchange", (_b = e.target.value) == null ? void 0 : _b.toString().replaceAll(",", "")) : emits("onchange", e.target.value);
|
||||
};
|
||||
const { prefixCls } = usePrefix("input");
|
||||
return (_ctx, _push, _parent, _attrs) => {
|
||||
const _component_a_input_password = __nuxt_component_0;
|
||||
const _component_a_input = Input;
|
||||
_push(`<div${ssrRenderAttrs(mergeProps({
|
||||
class: [unref(prefixCls)]
|
||||
}, _attrs))}><div>${ssrInterpolate(props.title)}</div>`);
|
||||
if (_ctx.isPassword) {
|
||||
_push(ssrRenderComponent(_component_a_input_password, {
|
||||
value: localValue.value,
|
||||
"onUpdate:value": ($event) => localValue.value = $event,
|
||||
"addon-after": props.addonAfter,
|
||||
"addon-before": props.addonBefore,
|
||||
disabled: props.disabled,
|
||||
placeHolder: props.placeHolder,
|
||||
size: props.size,
|
||||
type: props.type,
|
||||
class: "",
|
||||
autocomplete: false,
|
||||
onChange: handlerChange
|
||||
}, null, _parent));
|
||||
} else {
|
||||
_push(ssrRenderComponent(_component_a_input, {
|
||||
value: localValue.value,
|
||||
"onUpdate:value": ($event) => localValue.value = $event,
|
||||
"addon-after": props.addonAfter,
|
||||
"addon-before": props.addonBefore,
|
||||
disabled: props.disabled,
|
||||
placeHolder: props.placeHolder,
|
||||
size: props.size,
|
||||
inputmode: props.inputmode,
|
||||
autocomplete: false,
|
||||
type: props.type === "price" ? "tel" : props.type,
|
||||
class: "",
|
||||
onChange: handlerChange
|
||||
}, createSlots({ _: 2 }, [
|
||||
_ctx.$slots.addonBefore ? {
|
||||
name: "addonBefore",
|
||||
fn: withCtx((_, _push2, _parent2, _scopeId) => {
|
||||
if (_push2) {
|
||||
ssrRenderSlot(_ctx.$slots, "addonBefore", {}, null, _push2, _parent2, _scopeId);
|
||||
} else {
|
||||
return [
|
||||
renderSlot(_ctx.$slots, "addonBefore")
|
||||
];
|
||||
}
|
||||
}),
|
||||
key: "0"
|
||||
} : void 0,
|
||||
_ctx.$slots.addonAfter ? {
|
||||
name: "addonAfter",
|
||||
fn: withCtx((_, _push2, _parent2, _scopeId) => {
|
||||
if (_push2) {
|
||||
ssrRenderSlot(_ctx.$slots, "addonAfter", {}, null, _push2, _parent2, _scopeId);
|
||||
} else {
|
||||
return [
|
||||
renderSlot(_ctx.$slots, "addonAfter")
|
||||
];
|
||||
}
|
||||
}),
|
||||
key: "1"
|
||||
} : void 0
|
||||
]), _parent));
|
||||
}
|
||||
_push(`</div>`);
|
||||
};
|
||||
}
|
||||
});
|
||||
const _sfc_setup = _sfc_main.setup;
|
||||
_sfc_main.setup = (props, ctx) => {
|
||||
const ssrContext = useSSRContext();
|
||||
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/BasicPacks/BasicInput.vue");
|
||||
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
||||
};
|
||||
|
||||
export { _sfc_main as _ };
|
||||
//# sourceMappingURL=BasicInput-BEP6ZgUl.mjs.map
|
||||
Reference in New Issue
Block a user