2 lines
2.6 KiB
JavaScript
Raw Normal View History

2026-05-28 09:48:42 +08:00
"use strict";const e=require("../../../../common/vendor.js"),o={name:"u-search",mixins:[e.mpMixin,e.mixin,e.props$1],data(){return{keyword:"",show:!1,focused:this.focus}},watch:{keyword(e){this.$emit("update:modelValue",e),this.$emit("change",e)},modelValue:{immediate:!0,handler(e){this.keyword=e}}},computed:{showActionBtn(){return!this.animation&&this.showAction},isShowClear(){const{clearabled:e,focused:o,keyword:t,onlyClearableOnFocused:i}=this;return!!e&&(i?!!o&&""!==t:""!==t)}},emits:["clear","search","custom","focus","blur","click","clickIcon","update:modelValue","change"],methods:{addStyle:e.addStyle,addUnit:e.addUnit,inputChange(e){this.keyword=e.detail.value},clear(){this.keyword="",this.$nextTick(()=>{this.$emit("clear")})},search(o){this.$emit("search",o.detail.value);try{e.index.hideKeyboard()}catch(t){}},custom(){this.$emit("custom",this.keyword);try{e.index.hideKeyboard()}catch(o){}},getFocus(){this.focused=!0,this.animation&&this.showAction&&(this.show=!0),this.$emit("focus",this.keyword)},blurFunc(){setTimeout(()=>{this.focused=!1},100),this.show=!1,this.$emit("blur",this.keyword)},clickHandler(){this.disabled&&this.$emit("click")},clickIcon(o){this.$emit("clickIcon",this.keyword);try{e.index.hideKeyboard()}catch(t){}}}};if(!Array){e.resolveComponent("up-icon")()}Math;const t=e._export_sfc(o,[["render",function(o,t,i,c,s,r){return e.e({a:o.$slots.label||null!==o.label},o.$slots.label||null!==o.label?{b:e.t(o.label)}:{},{c:e.o(r.clickIcon),d:e.p({size:o.searchIconSize,name:o.searchIcon,color:o.searchIconColor?o.searchIconColor:o.color}),e:e.o((...e)=>r.blurFunc&&r.blurFunc(...e)),f:s.keyword,g:e.o((...e)=>r.search&&r.search(...e)),h:e.o((...e)=>r.inputChange&&r.inputChange(...e)),i:o.disabled,j:e.o((...e)=>r.getFocus&&r.getFocus(...e)),k:o.focus,l:o.maxlength,m:o.adjustPosition,n:o.autoBlur,o:o.placeholder,p:`color: ${o.placeholderColor}`,q:e.s({pointerEvents:o.disabled?"none":"auto",textAlign:o.inputAlign,color:o.color,backgroundColor:o.bgColor,height:r.addUnit(o.height)}),r:e.s(o.inputStyle),s:r.isShowClear},r.isShowClear?{t:e.p({name:"close",size:"11",color:"#ffffff",customStyle:"line-height: 12px"}),v:e.o((...e)=>r.clear&&r.clear(...e))}:{},{w:o.bgColor,x:"round"==o.shape?"100px":"4px",y:o.borderColor,z:e.t(o.actionText),A:e.s(o.actionStyle),B:e.n((r.showActionBtn||s.show)&&"u-search__action--active"),C:e.o((...e)=>r.custom&&r.custom(...e)),D:e.n("right"===o.iconPosition&&"u-search__reverse"),E:e.o((...e)=>r.clickHandler&&r.clickHandler(...e)),F:e.s({margin:o.margin}),G:e.s(r.addStyle(o.customStyle))})}],["__scopeId","data-v-cdd8f7ac"]]);wx.createComponent(t);