2 lines
2.2 KiB
JavaScript
2 lines
2.2 KiB
JavaScript
import{d as e,r as a,e as l,o as t,f as u,k as r,g as s,Y as n,h as o,aD as d,n as c,Q as p,R as i,P as g,M as m,Z as y,_ as v}from"./index_1730443402.js";const h={class:"h-input"},x={class:"code"},k=["placeholder","value"],b=["placeholder","type","maxlength","value"],f=["placeholder","maxlength","type","value"],q=v(e({__name:"index",props:{modelValue:{type:String,defaule:"",required:!0},type:{type:String,default:"text",required:!1},placeholder:{type:String,default:"",required:!1},background:{type:String,default:"",required:!1},color:{type:String,default:"#6e6c6c",required:!1},center:{type:Boolean,default:!1,required:!1},className:{type:String,default:"",required:!1},maxlength:{type:Number,default:999,required:!1}},emits:["update:modelValue","input","blur","code"],setup(e,{emit:v}){const q=e,_=a(!1),S=a("password"),V=e=>{_.value=e,S.value=e?"text":"password"},N=e=>{e.target.value.length>q.maxlength&&(e.target.value=e.target.value.slice(0,q.maxlength)),v("update:modelValue",e.target.value),v("input",e.target.value)},I=l((()=>({background:q.background,textAlign:q.center?"center":"left",color:q.color})));return(a,l)=>{const v=y;return t(),u("div",h,["mobile"==e.type?(t(),u("div",{key:0,class:"input-item",style:r({background:e.background})},[s("div",x,"+"+n(o(d)),1),s("input",{class:c(e.className),style:r(I.value),placeholder:e.placeholder,type:"number",value:e.modelValue,onInput:N},null,46,k)],4)):"password"==e.type?(t(),u("div",{key:1,class:"input-item",style:r({background:e.background})},[s("input",{class:c(e.className),style:r(I.value),placeholder:e.placeholder,type:S.value,maxlength:e.maxlength,value:e.modelValue,autocomplete:"off",onInput:N},null,46,b),p(g(v,{name:"closed-eye",color:"#6e6c6c",size:"30px",onClick:l[0]||(l[0]=e=>V(!0))},null,512),[[i,!_.value]]),p(g(v,{name:"eye-o",color:"#6e6c6c",size:"30px",onClick:l[1]||(l[1]=e=>V(!1))},null,512),[[i,_.value]])],4)):(t(),u("div",{key:2,class:"input-item",style:r({background:e.background})},[s("input",{class:c(e.className),style:r(I.value),placeholder:e.placeholder,maxlength:e.maxlength,type:e.type,value:e.modelValue,onInput:N},null,46,f),m(a.$slots,"right",{},void 0,!0)],4))])}}}),[["__scopeId","data-v-90221623"]]);export{q as _};
|