diff --git a/dist/main.js b/dist/main.js index 60e521c..bb0c83c 100644 --- a/dist/main.js +++ b/dist/main.js @@ -1 +1 @@ -!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["vue-flip-down"]=n():t["vue-flip-down"]=n()}(window,(function(){return function(t){var n={};function e(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:i})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(e.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(i,o,function(n){return t[n]}.bind(null,o));return i},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=1)}([function(t,n,e){var i=e(3),o=e(4);"string"==typeof(o=o.__esModule?o.default:o)&&(o=[[t.i,o,""]]);var r={insert:"head",singleton:!1},a=(i(t.i,o,r),o.locals?o.locals:{});t.exports=a},function(t,n,e){t.exports=e(6)},function(t,n,e){"use strict";var i=e(0);e.n(i).a},function(t,n,e){"use strict";var i,o=function(){return void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i},r=function(){var t={};return function(n){if(void 0===t[n]){var e=document.querySelector(n);if(window.HTMLIFrameElement&&e instanceof window.HTMLIFrameElement)try{e=e.contentDocument.head}catch(t){e=null}t[n]=e}return t[n]}}(),a={};function s(t,n,e){for(var i=0;i div {\n overflow: hidden;\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n -webkit-animation-duration: 400ms;\n animation-duration: 400ms;\n -webkit-transform: rotateX(-0.01deg);\n transform: rotateX(-0.01deg);\n border-radius: 3px;\n}\n.vue-countdown-component .time-box > div.base {\n position: relative;\n}\n.vue-countdown-component .time-box > div.base .base-b {\n position: absolute;\n left: 0;\n bottom: 0;\n border-radius: 0 0 3px 3px;\n width: 100%;\n height: 100%;\n background-color: #709bf1;\n -webkit-clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%);\n clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%);\n}\n.vue-countdown-component .time-box > div.face {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color: #6c96e8;\n -webkit-backface-visibility: visible;\n backface-visibility: visible;\n -webkit-clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);\n clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);\n z-index: 2;\n}\n.vue-countdown-component .time-box > div.face.anime {\n -webkit-animation-name: animate-filp-face;\n animation-name: animate-filp-face;\n}\n.vue-countdown-component .time-box > div.back {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color: #709bf1;\n -webkit-transform: rotateX(-180deg);\n transform: rotateX(-180deg);\n -webkit-backface-visibility: visible;\n backface-visibility: visible;\n -webkit-clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%);\n clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%);\n}\n.vue-countdown-component .time-box > div.back.anime {\n -webkit-animation-name: animate-filp-back;\n animation-name: animate-filp-back;\n}\n',""]),t.exports=n},function(t,n,e){"use strict";t.exports=function(t){var n=[];return n.toString=function(){return this.map((function(n){var e=function(t,n){var e=t[1]||"",i=t[3];if(!i)return e;if(n&&"function"==typeof btoa){var o=(a=i,s=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),c="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),"/*# ".concat(c," */")),r=i.sources.map((function(t){return"/*# sourceURL=".concat(i.sourceRoot).concat(t," */")}));return[e].concat(r).concat([o]).join("\n")}var a,s,c;return[e].join("\n")}(n,t);return n[2]?"@media ".concat(n[2]," {").concat(e,"}"):e})).join("")},n.i=function(t,e){"string"==typeof t&&(t=[[null,t,""]]);for(var i=0;i[]}},computed:{endTime(){return this.endDate instanceof Date?this.endDate.getTime():Number(this.endDate)>0?Number(this.endDate):0},step(){return 1===this.theme?1:2},arr(){const t=this.timeArray.length,n=this.step,e=[t-1,t-n-1,t-2*n-1,t-3*n-1];return e.length=this.type>1?this.type:1,e}},watch:{timeArray(t,n){const e=[];t.forEach((t,i)=>{t!==n[i]&&(e.push({value:t,index:i}),this.$set(this.isAnimate,i,!0))}),setTimeout(()=>{e.forEach(t=>{this.$set(this.timeArrayT,t.index,t.value)})},350)},endTime(t){t>0&&this.start()}},mounted(){(window.ActiveXObject||"ActiveXObject"in window||window.navigator.userAgent.indexOf("Edge")>-1)&&(this.isIE=!0),this.start(0)},beforeDestroy(){clearTimeout(this.timer)},methods:{start(t=1e3){clearTimeout(this.timer),this.timer=setTimeout(()=>{let t=this.endTime-(new Date).getTime();t=t<0?0:t;let n=0,e=0,i=0,o=0;const r=Number(this.type);r>=4?(n=Math.floor(t/864e5),e=Math.floor(t/36e5-24*n),i=Math.floor(t/6e4-1440*n-60*e),o=Math.floor(t/1e3-86400*n-3600*e-60*i)):r>=3?(e=Math.floor(t/36e5),i=Math.floor(t/6e4-60*e),o=Math.floor(t/1e3-3600*e-60*i)):r>=2?(i=Math.floor(t/6e4),o=Math.floor(t/1e3-60*i)):o=Math.floor(t/1e3);let a=[];1===Number(this.theme)?(r>=4&&a.push(String(n).padStart(2,"0")),r>=3&&a.push(String(e).padStart(2,"0")),r>=2&&a.push(String(i).padStart(2,"0")),a.push(String(o).padStart(2,"0"))):(r>=4&&a.push(...String(n).padStart(2,"0").split("")),r>=3&&a.push(...String(e).padStart(2,"0").split("")),r>=2&&a.push(...String(i).padStart(2,"0").split("")),a.push(...String(o).padStart(2,"0").split(""))),this.timeArray=a,t>0?this.start():this.$emit("timeUp")},t)},onAnimateEnd(t){this.$set(this.isAnimate,t,!1)},isTimeUnitShow(t){return!!this.arr.includes(t)&&!(t===this.timeArray.length-1&&!this.timeUnit[3])},setTimeUnit(t){switch(t){case this.timeArray.length-1:return this.timeUnit[3]||"";case this.timeArray.length-this.step-1:return this.timeUnit[2]||"";case this.timeArray.length-2*this.step-1:return this.timeUnit[1]||"";default:return this.timeUnit[0]||""}}}};e(2);var r=function(t,n,e,i,o,r,a,s){var c,u="function"==typeof t?t.options:t;if(n&&(u.render=n,u.staticRenderFns=e,u._compiled=!0),i&&(u.functional=!0),r&&(u._scopeId="data-v-"+r),a?(c=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__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},u._ssrRegister=c):o&&(c=s?function(){o.call(this,this.$root.$options.shadowRoot)}:o),c)if(u.functional){u._injectStyles=c;var p=u.render;u.render=function(t,n){return c.call(n),p(t,n)}}else{var l=u.beforeCreate;u.beforeCreate=l?[].concat(l,c):[c]}return{exports:t,options:u}}(o,i,[],!1,null,null,null);r.options.__file="src/app.vue";var a=r.exports;n.default=a}])})); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["vue-flip-down"]=e():t["vue-flip-down"]=e()}(this,(function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},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 i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},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=2)}([function(t,e,n){var i=n(4),o=n(5);"string"==typeof(o=o.__esModule?o.default:o)&&(o=[[t.i,o,""]]);var r={insert:"head",singleton:!1};i(o,r);t.exports=o.locals||{}},function(t,e,n){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"function"==typeof btoa){var o=(a=i,s=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),c="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),"/*# ".concat(c," */")),r=i.sources.map((function(t){return"/*# sourceURL=".concat(i.sourceRoot||"").concat(t," */")}));return[n].concat(r).concat([o]).join("\n")}var a,s,c;return[n].join("\n")}(e,t);return e[2]?"@media ".concat(e[2]," {").concat(n,"}"):n})).join("")},e.i=function(t,n,i){"string"==typeof t&&(t=[[null,t,""]]);var o={};if(i)for(var r=0;r div {\n overflow: hidden;\n -webkit-animation-timing-function: linear;\n animation-timing-function: linear;\n -webkit-animation-duration: 400ms;\n animation-duration: 400ms;\n -webkit-transform: rotateX(-0.01deg);\n transform: rotateX(-0.01deg);\n border-radius: 3px;\n}\n.vue-countdown-component .time-box > div.base {\n position: relative;\n}\n.vue-countdown-component .time-box > div.base .base-b {\n position: absolute;\n left: 0;\n bottom: 0;\n border-radius: 0 0 3px 3px;\n width: 100%;\n height: 100%;\n background-color: #709bf1;\n -webkit-clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%);\n clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%);\n}\n.vue-countdown-component .time-box > div.face {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color: #6c96e8;\n -webkit-backface-visibility: visible;\n backface-visibility: visible;\n -webkit-clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);\n clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);\n z-index: 2;\n}\n.vue-countdown-component .time-box > div.face.anime {\n -webkit-animation-name: animate-filp-face;\n animation-name: animate-filp-face;\n}\n.vue-countdown-component .time-box > div.back {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color: #709bf1;\n -webkit-transform: rotateX(-180deg);\n transform: rotateX(-180deg);\n -webkit-backface-visibility: visible;\n backface-visibility: visible;\n -webkit-clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%);\n clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%);\n}\n.vue-countdown-component .time-box > div.back.anime {\n -webkit-animation-name: animate-filp-back;\n animation-name: animate-filp-back;\n}\n',""]),e.default=o},function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:["vue-countdown-component",{theme2:1!==t.theme},{ie:t.isIE}]},[t._l(t.timeArray,(function(e,i){return[n("div",{key:i,class:["time-box"]},[n("div",{staticClass:"base"},[t._v(t._s(e)),n("div",{staticClass:"base-b"},[t._v(t._s(t.timeArrayT[i]))])]),t._v(" "),n("div",{class:["face",{anime:t.isAnimate[i]}],on:{animationend:function(e){return t.onAnimateEnd(i)}}},[t._v(t._s(t.timeArrayT[i]))]),t._v(" "),n("div",{class:["back",{anime:t.isAnimate[i]}]},[t._v(t._s(e))])]),t._v(" "),t.isTimeUnitShow(i)?n("div",{key:"unit-"+i,staticClass:"time-unit"},[t._v("\n "+t._s(t.setTimeUnit(i))+"\n ")]):t._e()]}))],2)};i._withStripped=!0;var o={data(){return{isIE:!1,timeArray:2===this.theme?new Array(2*this.type).fill("0"):new Array(this.type).fill("00"),timeArrayT:2===this.theme?new Array(2*this.type).fill("0"):new Array(this.type).fill("00"),isAnimate:2===this.theme?new Array(2*this.type).fill(!1):new Array(this.type).fill(!1)}},props:{endDate:{type:[Date,Number,String],default:0},type:{type:[Number,String],default:4},theme:{type:[Number,String],default:1},timeUnit:{type:Array,default:()=>[]}},computed:{endTime(){return this.endDate instanceof Date?this.endDate.getTime():Number(this.endDate)>0?Number(this.endDate):0},step(){return 1===this.theme?1:2},arr(){const t=this.timeArray.length,e=this.step,n=[t-1,t-e-1,t-2*e-1,t-3*e-1];return n.length=this.type>1?this.type:1,n}},watch:{timeArray(t,e){const n=[];t.forEach((t,i)=>{t!==e[i]&&(n.push({value:t,index:i}),this.$set(this.isAnimate,i,!0))}),setTimeout(()=>{n.forEach(t=>{this.$set(this.timeArrayT,t.index,t.value)})},350)},endTime(t){t>0&&this.start()}},mounted(){(window.ActiveXObject||"ActiveXObject"in window||window.navigator.userAgent.indexOf("Edge")>-1)&&(this.isIE=!0),this.start(0)},beforeDestroy(){clearTimeout(this.timer)},methods:{start(t=1e3){clearTimeout(this.timer),this.timer=setTimeout(()=>{let t=this.endTime-(new Date).getTime();t=t<0?0:t;let e=0,n=0,i=0,o=0;const r=Number(this.type);r>=4?(e=Math.floor(t/864e5),n=Math.floor(t/36e5-24*e),i=Math.floor(t/6e4-1440*e-60*n),o=Math.floor(t/1e3-86400*e-3600*n-60*i)):r>=3?(n=Math.floor(t/36e5),i=Math.floor(t/6e4-60*n),o=Math.floor(t/1e3-3600*n-60*i)):r>=2?(i=Math.floor(t/6e4),o=Math.floor(t/1e3-60*i)):o=Math.floor(t/1e3);let a=[];1===Number(this.theme)?(r>=4&&a.push(String(e).padStart(2,"0")),r>=3&&a.push(String(n).padStart(2,"0")),r>=2&&a.push(String(i).padStart(2,"0")),a.push(String(o).padStart(2,"0"))):(r>=4&&a.push(...String(e).padStart(2,"0").split("")),r>=3&&a.push(...String(n).padStart(2,"0").split("")),r>=2&&a.push(...String(i).padStart(2,"0").split("")),a.push(...String(o).padStart(2,"0").split(""))),this.timeArray=a,t>0?this.start():this.$emit("timeUp")},t)},onAnimateEnd(t){this.$set(this.isAnimate,t,!1)},isTimeUnitShow(t){return!!this.arr.includes(t)&&!(t===this.timeArray.length-1&&!this.timeUnit[3])},setTimeUnit(t){switch(t){case this.timeArray.length-1:return this.timeUnit[3]||"";case this.timeArray.length-this.step-1:return this.timeUnit[2]||"";case this.timeArray.length-2*this.step-1:return this.timeUnit[1]||"";default:return this.timeUnit[0]||""}}}};n(3);var r=function(t,e,n,i,o,r,a,s){var c,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),r&&(u._scopeId="data-v-"+r),a?(c=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__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},u._ssrRegister=c):o&&(c=s?function(){o.call(this,(u.functional?this.parent:this).$root.$options.shadowRoot)}:o),c)if(u.functional){u._injectStyles=c;var p=u.render;u.render=function(t,e){return c.call(e),p(t,e)}}else{var l=u.beforeCreate;u.beforeCreate=l?[].concat(l,c):[c]}return{exports:t,options:u}}(o,i,[],!1,null,null,null);r.options.__file="src/app.vue";var a=r.exports;e.default=a}])})); \ No newline at end of file diff --git a/package.json b/package.json index 4f1770a..a30180b 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,11 @@ { "name": "vue-flip-down", - "version": "1.0.5", + "version": "1.0.6", "description": "vue 翻页效果的倒计时组件", "main": "dist/main.js", + "files": [ + "dist/" + ], "scripts": { "dev": "webpack-dev-server --config webpack.dev.config.js", "build": "webpack --config webpack.production.config.js --progress --profile --colors", @@ -22,35 +25,35 @@ }, "homepage": "https://github.com/javaLuo/vue-flip-down#readme", "dependencies": { - "optimize-css-assets-webpack-plugin": "^5.0.3", - "terser-webpack-plugin": "^2.3.1", - "vue": "^2.6.11" + "optimize-css-assets-webpack-plugin": "^5.0.4", + "terser-webpack-plugin": "^4.1.0", + "vue": "^2.6.12" }, "devDependencies": { - "@babel/core": "^7.7.7", - "@babel/plugin-proposal-class-properties": "^7.7.4", - "@babel/plugin-proposal-object-rest-spread": "^7.7.7", - "@babel/plugin-syntax-dynamic-import": "^7.7.4", - "@babel/plugin-transform-runtime": "^7.7.6", - "@babel/polyfill": "^7.7.0", - "@babel/runtime": "^7.7.7", - "autoprefixer": "^9.7.3", - "babel-loader": "^8.0.6", + "@babel/core": "^7.11.6", + "@babel/plugin-proposal-class-properties": "^7.10.4", + "@babel/plugin-proposal-object-rest-spread": "^7.11.0", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-transform-runtime": "^7.11.5", + "@babel/polyfill": "^7.11.5", + "@babel/runtime": "^7.11.2", + "autoprefixer": "^9.8.6", + "babel-loader": "^8.1.0", "babel-plugin-import": "^1.13.0", "babel-plugin-transform-decorators-legacy": "^1.3.5", "babel-preset-vue-app": "^2.0.0", "clean-webpack-plugin": "^3.0.0", - "css-loader": "^3.4.0", - "less": "^3.10.3", - "less-loader": "^5.0.0", - "postcss-loader": "^3.0.0", - "style-loader": "^1.1.2", - "url-loader": "^3.0.0", - "vue-loader": "^15.8.3", - "vue-template-compiler": "^2.6.11", - "webpack": "^4.41.5", - "webpack-cli": "^3.3.10", - "webpack-dev-server": "^3.10.1" + "css-loader": "^4.3.0", + "less": "^3.12.2", + "less-loader": "^7.0.1", + "postcss-loader": "^4.0.1", + "style-loader": "^1.2.1", + "url-loader": "^4.1.0", + "vue-loader": "^15.9.3", + "vue-template-compiler": "^2.6.12", + "webpack": "^4.44.1", + "webpack-cli": "^3.3.12", + "webpack-dev-server": "^3.11.0" }, "browserslist": [ "iOS >= 8", diff --git a/webpack.production.config.js b/webpack.production.config.js index b146035..8c96d75 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -16,6 +16,7 @@ module.exports = { filename: "[name].js", //编译后的文件名字 library: ["vue-flip-down"], libraryTarget: "umd", + globalObject: 'this' }, externals: { vue: "vue",