uni-transition.js 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. (global.webpackJsonp = global.webpackJsonp || []).push([ [ "components/uni-transition/uni-transition" ], {
  2. 556: function(t, n, e) {
  3. e.r(n);
  4. var r = e(557), o = e(559);
  5. for (var i in o) "default" !== i && function(t) {
  6. e.d(n, t, function() {
  7. return o[t];
  8. });
  9. }(i);
  10. e(561);
  11. var a = e(13), c = Object(a.default)(o.default, r.render, r.staticRenderFns, !1, null, null, null, !1, r.components, void 0);
  12. c.options.__file = "components/uni-transition/uni-transition.vue", n.default = c.exports;
  13. },
  14. 557: function(t, n, e) {
  15. e.r(n);
  16. var r = e(558);
  17. e.d(n, "render", function() {
  18. return r.render;
  19. }), e.d(n, "staticRenderFns", function() {
  20. return r.staticRenderFns;
  21. }), e.d(n, "recyclableRender", function() {
  22. return r.recyclableRender;
  23. }), e.d(n, "components", function() {
  24. return r.components;
  25. });
  26. },
  27. 558: function(t, n, e) {
  28. e.r(n), e.d(n, "render", function() {
  29. return r;
  30. }), e.d(n, "staticRenderFns", function() {
  31. return i;
  32. }), e.d(n, "recyclableRender", function() {
  33. return o;
  34. }), e.d(n, "components", function() {});
  35. var r = function() {
  36. var t = this;
  37. t.$createElement;
  38. t._self._c;
  39. }, o = !1, i = [];
  40. r._withStripped = !0;
  41. },
  42. 559: function(t, n, e) {
  43. e.r(n);
  44. var r = e(560), o = e.n(r);
  45. for (var i in r) "default" !== i && function(t) {
  46. e.d(n, t, function() {
  47. return r[t];
  48. });
  49. }(i);
  50. n.default = o.a;
  51. },
  52. 560: function(t, n, e) {
  53. function r(t, n) {
  54. var e = Object.keys(t);
  55. if (Object.getOwnPropertySymbols) {
  56. var r = Object.getOwnPropertySymbols(t);
  57. n && (r = r.filter(function(n) {
  58. return Object.getOwnPropertyDescriptor(t, n).enumerable;
  59. })), e.push.apply(e, r);
  60. }
  61. return e;
  62. }
  63. function o(t) {
  64. for (var n = 1; n < arguments.length; n++) {
  65. var e = null != arguments[n] ? arguments[n] : {};
  66. n % 2 ? r(Object(e), !0).forEach(function(n) {
  67. i(t, n, e[n]);
  68. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(e)) : r(Object(e)).forEach(function(n) {
  69. Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(e, n));
  70. });
  71. }
  72. return t;
  73. }
  74. function i(t, n, e) {
  75. return n in t ? Object.defineProperty(t, n, {
  76. value: e,
  77. enumerable: !0,
  78. configurable: !0,
  79. writable: !0
  80. }) : t[n] = e, t;
  81. }
  82. Object.defineProperty(n, "__esModule", {
  83. value: !0
  84. }), n.default = void 0;
  85. var a = {
  86. name: "uniTransition",
  87. props: {
  88. show: {
  89. type: Boolean,
  90. default: !1
  91. },
  92. modeClass: {
  93. type: Array,
  94. default: function() {
  95. return [];
  96. }
  97. },
  98. duration: {
  99. type: Number,
  100. default: 300
  101. },
  102. styles: {
  103. type: Object,
  104. default: function() {
  105. return {};
  106. }
  107. }
  108. },
  109. data: function() {
  110. return {
  111. isShow: !1,
  112. transform: "",
  113. ani: {
  114. in: "",
  115. active: ""
  116. }
  117. };
  118. },
  119. watch: {
  120. show: {
  121. handler: function(t) {
  122. t ? this.open() : this.close();
  123. },
  124. immediate: !0
  125. }
  126. },
  127. computed: {
  128. stylesObject: function() {
  129. var t = o(o({}, this.styles), {}, {
  130. "transition-duration": this.duration / 1e3 + "s"
  131. }), n = "";
  132. for (var e in t) n += this.toLine(e) + ":" + t[e] + ";";
  133. return n;
  134. }
  135. },
  136. created: function() {},
  137. methods: {
  138. change: function() {
  139. this.$emit("click", {
  140. detail: this.isShow
  141. });
  142. },
  143. open: function() {
  144. var t = this;
  145. for (var n in clearTimeout(this.timer), this.isShow = !0, this.transform = "", this.ani.in = "",
  146. this.getTranfrom(!1)) "opacity" === n ? this.ani.in = "fade-in" : this.transform += "".concat(this.getTranfrom(!1)[n], " ");
  147. this.$nextTick(function() {
  148. setTimeout(function() {
  149. t._animation(!0);
  150. }, 50);
  151. });
  152. },
  153. close: function(t) {
  154. clearTimeout(this.timer), this._animation(!1);
  155. },
  156. _animation: function(t) {
  157. var n = this, e = this.getTranfrom(t);
  158. for (var r in this.transform = "", e) "opacity" === r ? this.ani.in = "fade-".concat(t ? "out" : "in") : this.transform += "".concat(e[r], " ");
  159. this.timer = setTimeout(function() {
  160. t || (n.isShow = !1), n.$emit("change", {
  161. detail: n.isShow
  162. });
  163. }, this.duration);
  164. },
  165. getTranfrom: function(t) {
  166. var n = {
  167. transform: ""
  168. };
  169. return this.modeClass.forEach(function(e) {
  170. switch (e) {
  171. case "fade":
  172. n.opacity = t ? 1 : 0;
  173. break;
  174. case "slide-top":
  175. n.transform += "translateY(".concat(t ? "0" : "-100%", ") ");
  176. break;
  177. case "slide-right":
  178. n.transform += "translateX(".concat(t ? "0" : "100%", ") ");
  179. break;
  180. case "slide-bottom":
  181. n.transform += "translateY(".concat(t ? "0" : "100%", ") ");
  182. break;
  183. case "slide-left":
  184. n.transform += "translateX(".concat(t ? "0" : "-100%", ") ");
  185. break;
  186. case "zoom-in":
  187. n.transform += "scale(".concat(t ? 1 : .8, ") ");
  188. break;
  189. case "zoom-out":
  190. n.transform += "scale(".concat(t ? 1 : 1.2, ") ");
  191. }
  192. }), n;
  193. },
  194. _modeClassArr: function(t) {
  195. var n = this.modeClass;
  196. if ("string" != typeof n) {
  197. var e = "";
  198. return n.forEach(function(n) {
  199. e += n + "-" + t + ",";
  200. }), e.substr(0, e.length - 1);
  201. }
  202. return n + "-" + t;
  203. },
  204. toLine: function(t) {
  205. return t.replace(/([A-Z])/g, "-$1").toLowerCase();
  206. }
  207. }
  208. };
  209. n.default = a;
  210. },
  211. 561: function(t, n, e) {
  212. e.r(n);
  213. var r = e(562), o = e.n(r);
  214. for (var i in r) "default" !== i && function(t) {
  215. e.d(n, t, function() {
  216. return r[t];
  217. });
  218. }(i);
  219. n.default = o.a;
  220. },
  221. 562: function(t, n, e) {}
  222. } ]), (global.webpackJsonp = global.webpackJsonp || []).push([ "components/uni-transition/uni-transition-create-component", {
  223. "components/uni-transition/uni-transition-create-component": function(t, n, e) {
  224. e("1").createComponent(e(556));
  225. }
  226. }, [ [ "components/uni-transition/uni-transition-create-component" ] ] ]);