UNPKG

zzy-clock

Version:

2 lines 2.66 kB
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["zzy-clock"]=t():e["zzy-clock"]=t()})("undefined"!==typeof self?self:this,(function(){return function(){"use strict";var e={};!function(){e.d=function(t,n){for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})}}(),function(){e.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}(),function(){e.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}}(),function(){e.p=""}();var t={};if(e.r(t),e.d(t,{default:function(){return p}}),"undefined"!==typeof window){var n=window.document.currentScript,o=n&&n.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);o&&(e.p=o[1])}var r=function(){var e=this,t=e._self._c;return t("div",{attrs:{id:"clock"}},[t("div",{staticClass:"box",style:{color:e.textColor}},[t("span",{staticClass:"date"},[e._v(e._s(e.date))]),t("span",{staticClass:"time"},[e._v(e._s(e.time))])])])},i=[],s={name:"wqClock",props:{textColor:{type:String,default:"#2cf3fb"}},data(){return{timer:null,date:"",time:""}},created(){this.updateTime()},mounted(){this.timer=setInterval((()=>{this.updateTime()}),1e3)},methods:{updateTime(){let e=new Date,t="-",n=":",o=f(e.getFullYear()),r=f(e.getMonth()+1),i=f(e.getDate()),s=f(e.getHours()),a=f(e.getMinutes()),c=f(e.getSeconds()),d=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],u=d[e.getDay()];function f(e){return e>=0&&e<10?"0"+e:e}this.date=o+t+r+t+i+` ${u}`,this.time=s+n+a+n+c}},beforeDestroy(){clearInterval(this.timer)}},a=s;function c(e,t,n,o,r,i,s,a){var c,d="function"===typeof e?e.options:e;if(t&&(d.render=t,d.staticRenderFns=n,d._compiled=!0),o&&(d.functional=!0),i&&(d._scopeId="data-v-"+i),s?(c=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(s)},d._ssrRegister=c):r&&(c=a?function(){r.call(this,(d.functional?this.parent:this).$root.$options.shadowRoot)}:r),c)if(d.functional){d._injectStyles=c;var u=d.render;d.render=function(e,t){return c.call(t),u(e,t)}}else{var f=d.beforeCreate;d.beforeCreate=f?[].concat(f,c):[c]}return{exports:e,options:d}}var d=c(a,r,i,!1,null,"7f7c3a7e",null),u=d.exports;const f=e=>{e.component("ZzyClock",u)};var l=f,p=l;return t}()})); //# sourceMappingURL=zzy-clock.umd.min.js.map