UNPKG

@beeapi/nutui

Version:

一套轻量级移动端Vue组件库

7 lines 7.6 kB
/*! * @beeapi/nutui v2.2.10 - shortpassword.js, 451ed2404bee284b891e, Sat Dec 19 2020 12:06:10 GMT+0800 (中国标准时间) * (c) 2017-2020 JDC * Released under the MIT License. */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("vue")):"function"==typeof define&&define.amd?define("shortpassword",["vue"],e):"object"==typeof exports?exports.shortpassword=e(require("vue")):t.shortpassword=e(t.Vue)}("undefined"!=typeof self?self:this,(function(t){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="./",n(n.s=176)}({0:function(t,e,n){"use strict";function o(t,e,n,o,r,a,s,i){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),o&&(u.functional=!0),a&&(u._scopeId="data-v-"+a),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):r&&(l=i?function(){r.call(this,(u.functional?this.parent:this).$root.$options.shadowRoot)}:r),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var p=u.beforeCreate;u.beforeCreate=p?[].concat(p,l):[l]}return{exports:t,options:u}}n.d(e,"a",(function(){return o}))},1:function(e,n){e.exports=t},10:function(t,e,n){"use strict";n(8);var o=n(2),r=n.n(o),a=n(1),s=n.n(a);s.a.config.lang="zn-CH";var i={lang:{okBtnTxt:"确 定",cancelBtnTxt:"取 消",calendar:{loadPrevMonth:"加载上一个月",noMoreMonth:"没有更早月份~",start:"开始",end:"结束",title:"选择日期",week:"日,一,二,三,四,五,六",monthTitle:"{year}年{month}月"},menu:{resetBtnTxt:"重置"},searchbar:{placeText:"请输入内容...",textInfo:"搜索"},shortpassword:{tip1:"输入数字密码",tip2:"忘记密码"},steps:{step:"步骤",stepDesc:"步骤描述"},uploader:{xmlError:"对不起,您的浏览器不支持本组件!",typeError:"不支持上传该类型文件",limitError:"文件大小超过限制"}}},l={},u=!1,c=function(){var t=Object.getPrototypeOf(this||s.a).$t;if("function"==typeof t&&s.a.locale)return u||(u=!0,s.a.locale(s.a.config.lang,r()("zn-CH"===s.a.config.lang?i:{},s.a.locale(s.a.config.lang)||{},l))),t.apply(this,arguments)};function p(t,e){var n=c.apply(this,arguments);if(null!=n)return n;var o=r()({},"zn-CH"===s.a.config.lang?i:{},l),a=t&&t.split(".")||[],u=null;if(a.length)for(var p=0;p<a.length;p++){var d=a[p];if(!d||!o[d]){u=null;break}u=o=o[d]}return f(u,e)}function f(t,e){var n=t&&t.match(/{.+?}/g);return n&&e&&(n=n.map((function(t){return t.replace(/\{\s*(\w+|\d+).*?\}/,"$1")}))).forEach((function(n,o){var r=new RegExp("{\\s*"+n+"\\s*(?:=\\s*(\\S*?))?\\s*?}","g");t=t.replace(r,(function(t,o){return"function"==(r=e[n],Object.prototype.toString.call(r).toLowerCase().match(/\s(\w+)/)[1])?e[n]():void 0!==e[n]?e[n]:o||t;var r}))})),t}e.a={methods:{nutTranslate:function(){return p.apply(this,arguments)}}}},114:function(t,e,n){},176:function(t,e,n){"use strict";n.r(e);var o={name:"nut-shortpassword",mixins:[n(10).a],props:{visible:{type:Boolean,default:!1},link:{type:String,default:"javascript:;"},type:{type:String,default:"bottom"}},data:function(){return{shortpwdValue:"",regExp:/^[0-9]*$/,fakeInputItems:[{id:1,val:""},{id:2,val:""},{id:3,val:""},{id:4,val:""},{id:5,val:""},{id:6,val:""}],timer:null,isCenter:"bottom"!=this.type,layerTran:"bottom"==this.type?"popup":"fade",show:!1}},watch:{visible:function(t,e){var n=this;t?this.show=t:(clearTimeout(this.timer),this.timer=setTimeout((function(){n.show=t}),100))}},methods:{closeLayer:function(){var t=this;this.timer=setTimeout((function(){t.$emit("close")}),300)},shortpwdInput:function(t){var e=this,n=t.target.value;if(this.regExp.test(n)){if(n.length<6){var o=this.$refs.nutFakeList.offsetLeft+26;n.length}else this.$refs.realInput.blur(),this.timer=setTimeout((function(){e.$emit("close",n),e.shortpwdValue="",e.fakeInputItems=[{id:1,val:""},{id:2,val:""},{id:3,val:""},{id:4,val:""},{id:5,val:""},{id:6,val:""}]}),300);for(var r=0;r<n.length;r++)this.fakeInputItems[r].val=n[r]}else this.shortpwdValue=n.replace(/\D/g,"");for(r=0;r<6;r++)r>=n.length&&(this.fakeInputItems[r].val="")}},computed:{},mounted:function(){},destroyed:function(){this.timer=null}},r=n(0),a=Object(r.a)(o,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"show",rawName:"v-show",value:t.show,expression:"show"}],staticClass:"nut-short-pwd"},[n("transition",{attrs:{name:"fade"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.show,expression:"show"}],staticClass:"nut-mask",on:{click:t.closeLayer}})]),t._v(" "),n("transition",{attrs:{name:t.layerTran}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.show,expression:"show"}],staticClass:"nut-layer",class:{"nut-layer-center":t.isCenter}},[n("div",{staticClass:"nut-title"},[n("span",{staticClass:"nut-close",on:{click:t.closeLayer}}),t._v("\n "+t._s(t.nutTranslate("lang.shortpassword.tip1"))+"\n ")]),t._v(" "),n("div",{staticClass:"nut-input-w"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.shortpwdValue,expression:"shortpwdValue"}],ref:"realInput",staticClass:"nut-real-input",attrs:{type:"tel",maxlength:"6",autocomplete:"off",autofocus:"autofocus"},domProps:{value:t.shortpwdValue},on:{input:[function(e){e.target.composing||(t.shortpwdValue=e.target.value)},function(e){return t.shortpwdInput(e)}]}}),t._v(" "),n("div",{ref:"nutFakeList",staticClass:"nut-fake-list"},[n("ul",t._l(t.fakeInputItems,(function(e){return n("li",{key:e.id},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.val,expression:"item.val"}],attrs:{type:"password",maxlength:"1"},domProps:{value:e.val},on:{input:function(n){n.target.composing||t.$set(e,"val",n.target.value)}}})])})),0)]),t._v(" "),""!=t.link?n("div",{staticClass:"nut-forget"},[n("a",{attrs:{href:t.link}},[t._v(t._s(t.nutTranslate("lang.shortpassword.tip2")))])]):t._e()])])])],1)}),[],!1,null,null,null).exports;n(114);a.install=function(t){t.component(a.name,a)};e.default=a},2:function(t,e){function n(){return t.exports=n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},n.apply(this,arguments)}t.exports=n},8:function(t,e){function n(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=n=function(t){return typeof t}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(e)}t.exports=n}})})); //# sourceMappingURL=shortpassword.js.map