UNPKG

vuux

Version:

Vue3 Nuxt3 Nuxt4 组件库

2 lines (1 loc) 3.08 kB
"use strict";const e=require("vue"),N=require("./hook/useInput.cjs"),u=require("@vuux/icons"),b={key:0,class:"is-prepend"},w=["rows","id","name","value","placeholder","maxlength","disabled","readonly"],E=["type","id","name","value","placeholder","maxlength","disabled","readonly"],g={key:4,ref:"countEl",class:"input-text"},v={key:5,class:"is-append"},z=e.defineComponent({name:"UInput",__name:"index",props:{modelValue:{default:""},placeholder:{default:""},clear:{type:Boolean,default:!1},count:{type:Boolean,default:!1},maxCount:{},disabled:{type:Boolean},type:{default:"text"},rows:{default:5},readonly:{type:Boolean}},emits:["update:modelValue","blur","input"],setup(B,{emit:C}){const n=B,x=C,s=e.useSlots(),{inputId:c,inputName:d,localValue:a,show:i,isTextarea:h,isPassword:p,className:m,currentType:I,textCount:f,onInput:l,onBlur:r,onClear:V,onPassword:k}=N.useInput(n,x);return(y,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["app-input",{"is-disabled":n.disabled}])},[e.unref(s).prepend?(e.openBlock(),e.createElementBlock("div",b,[e.renderSlot(y.$slots,"prepend")])):e.createCommentVNode("",!0),e.createElementVNode("form",null,[e.unref(h)?(e.openBlock(),e.createElementBlock("textarea",{key:0,rows:n.rows,id:e.unref(c),name:e.unref(d),class:e.normalizeClass(e.unref(m)),value:e.unref(a),placeholder:n.placeholder,maxlength:n.maxCount,disabled:n.disabled,readonly:n.readonly,autocomplete:"off",onInput:o[0]||(o[0]=(...t)=>e.unref(l)&&e.unref(l)(...t)),onBlur:o[1]||(o[1]=(...t)=>e.unref(r)&&e.unref(r)(...t))},null,42,w)):(e.openBlock(),e.createElementBlock("input",{key:1,type:e.unref(I),id:e.unref(c),name:e.unref(d),class:e.normalizeClass(e.unref(m)),value:e.unref(a),placeholder:n.placeholder,maxlength:n.maxCount,disabled:n.disabled,readonly:n.readonly,autocomplete:"off",onInput:o[2]||(o[2]=(...t)=>e.unref(l)&&e.unref(l)(...t)),onBlur:o[3]||(o[3]=(...t)=>e.unref(r)&&e.unref(r)(...t))},null,42,E))]),n.clear&&e.unref(a)?(e.openBlock(),e.createBlock(e.unref(u.Icon),{key:1,name:"Icon9176914",size:14,opacity:.8,onClick:e.withModifiers(e.unref(V),["stop"])},null,8,["onClick"])):e.createCommentVNode("",!0),e.unref(p)&&!e.unref(i)?(e.openBlock(),e.createBlock(e.unref(u.Icon),{key:2,name:"Icon9900314",size:14,opacity:.8,onClick:e.withModifiers(e.unref(k),["stop"])},null,8,["onClick"])):e.createCommentVNode("",!0),e.unref(p)&&e.unref(i)?(e.openBlock(),e.createBlock(e.unref(u.Icon),{key:3,name:"Icon9900324",size:14,opacity:.8,onClick:e.withModifiers(e.unref(k),["stop"])},null,8,["onClick"])):e.createCommentVNode("",!0),n.count?(e.openBlock(),e.createElementBlock("div",g,[n.maxCount?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(e.unref(f))+" / "+e.toDisplayString(n.maxCount),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(e.unref(f)),1)],64))],512)):e.createCommentVNode("",!0),e.unref(s).append?(e.openBlock(),e.createElementBlock("div",v,[e.renderSlot(y.$slots,"append")])):e.createCommentVNode("",!0)],2))}});module.exports=z;