1 | module.exports =
|
2 | (function(modules) {
|
3 |
|
4 | var installedModules = {};
|
5 |
|
6 |
|
7 | function __webpack_require__(moduleId) {
|
8 |
|
9 |
|
10 | if(installedModules[moduleId]) {
|
11 | return installedModules[moduleId].exports;
|
12 | }
|
13 |
|
14 | var module = installedModules[moduleId] = {
|
15 | i: moduleId,
|
16 | l: false,
|
17 | exports: {}
|
18 | };
|
19 |
|
20 |
|
21 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
22 |
|
23 |
|
24 | module.l = true;
|
25 |
|
26 |
|
27 | return module.exports;
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 | __webpack_require__.m = modules;
|
33 |
|
34 |
|
35 | __webpack_require__.c = installedModules;
|
36 |
|
37 |
|
38 | __webpack_require__.d = function(exports, name, getter) {
|
39 | if(!__webpack_require__.o(exports, name)) {
|
40 | Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
41 | }
|
42 | };
|
43 |
|
44 |
|
45 | __webpack_require__.r = function(exports) {
|
46 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
47 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
48 | }
|
49 | Object.defineProperty(exports, '__esModule', { value: true });
|
50 | };
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 | __webpack_require__.t = function(value, mode) {
|
58 | if(mode & 1) value = __webpack_require__(value);
|
59 | if(mode & 8) return value;
|
60 | if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
61 | var ns = Object.create(null);
|
62 | __webpack_require__.r(ns);
|
63 | Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
64 | if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
65 | return ns;
|
66 | };
|
67 |
|
68 |
|
69 | __webpack_require__.n = function(module) {
|
70 | var getter = module && module.__esModule ?
|
71 | function getDefault() { return module['default']; } :
|
72 | function getModuleExports() { return module; };
|
73 | __webpack_require__.d(getter, 'a', getter);
|
74 | return getter;
|
75 | };
|
76 |
|
77 |
|
78 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
79 |
|
80 |
|
81 | __webpack_require__.p = "/dist/";
|
82 |
|
83 |
|
84 |
|
85 | return __webpack_require__(__webpack_require__.s = 75);
|
86 | })
|
87 |
|
88 | ({
|
89 |
|
90 | 0:
|
91 | (function(module, __webpack_exports__, __webpack_require__) {
|
92 |
|
93 | "use strict";
|
94 | __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 | function normalizeComponent (
|
102 | scriptExports,
|
103 | render,
|
104 | staticRenderFns,
|
105 | functionalTemplate,
|
106 | injectStyles,
|
107 | scopeId,
|
108 | moduleIdentifier, /* server only */
|
109 | shadowMode /* vue-cli only */
|
110 | ) {
|
111 |
|
112 | var options = typeof scriptExports === 'function'
|
113 | ? scriptExports.options
|
114 | : scriptExports
|
115 |
|
116 |
|
117 | if (render) {
|
118 | options.render = render
|
119 | options.staticRenderFns = staticRenderFns
|
120 | options._compiled = true
|
121 | }
|
122 |
|
123 |
|
124 | if (functionalTemplate) {
|
125 | options.functional = true
|
126 | }
|
127 |
|
128 |
|
129 | if (scopeId) {
|
130 | options._scopeId = 'data-v-' + scopeId
|
131 | }
|
132 |
|
133 | var hook
|
134 | if (moduleIdentifier) {
|
135 | hook = function (context) {
|
136 |
|
137 | context =
|
138 | context ||
|
139 | (this.$vnode && this.$vnode.ssrContext) ||
|
140 | (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext)
|
141 |
|
142 | if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
143 | context = __VUE_SSR_CONTEXT__
|
144 | }
|
145 |
|
146 | if (injectStyles) {
|
147 | injectStyles.call(this, context)
|
148 | }
|
149 |
|
150 | if (context && context._registeredComponents) {
|
151 | context._registeredComponents.add(moduleIdentifier)
|
152 | }
|
153 | }
|
154 |
|
155 |
|
156 | options._ssrRegister = hook
|
157 | } else if (injectStyles) {
|
158 | hook = shadowMode
|
159 | ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
|
160 | : injectStyles
|
161 | }
|
162 |
|
163 | if (hook) {
|
164 | if (options.functional) {
|
165 |
|
166 |
|
167 | options._injectStyles = hook
|
168 |
|
169 | var originalRender = options.render
|
170 | options.render = function renderWithStyleInjection (h, context) {
|
171 | hook.call(context)
|
172 | return originalRender(h, context)
|
173 | }
|
174 | } else {
|
175 |
|
176 | var existing = options.beforeCreate
|
177 | options.beforeCreate = existing
|
178 | ? [].concat(existing, hook)
|
179 | : [hook]
|
180 | }
|
181 | }
|
182 |
|
183 | return {
|
184 | exports: scriptExports,
|
185 | options: options
|
186 | }
|
187 | }
|
188 |
|
189 |
|
190 | }),
|
191 |
|
192 | 15:
|
193 | (function(module, exports) {
|
194 |
|
195 | module.exports = require("element-ui/lib/utils/popup");
|
196 |
|
197 | }),
|
198 |
|
199 | 23:
|
200 | (function(module, exports) {
|
201 |
|
202 | module.exports = require("element-ui/lib/utils/vdom");
|
203 |
|
204 | }),
|
205 |
|
206 | 7:
|
207 | (function(module, exports) {
|
208 |
|
209 | module.exports = require("vue");
|
210 |
|
211 | }),
|
212 |
|
213 | 75:
|
214 | (function(module, __webpack_exports__, __webpack_require__) {
|
215 |
|
216 | "use strict";
|
217 | __webpack_require__.r(__webpack_exports__);
|
218 |
|
219 |
|
220 | var external_vue_ = __webpack_require__(7);
|
221 | var external_vue_default = __webpack_require__.n(external_vue_);
|
222 |
|
223 |
|
224 | var render = function() {
|
225 | var _vm = this
|
226 | var _h = _vm.$createElement
|
227 | var _c = _vm._self._c || _h
|
228 | return _c(
|
229 | "transition",
|
230 | {
|
231 | attrs: { name: "el-message-fade" },
|
232 | on: { "after-leave": _vm.handleAfterLeave }
|
233 | },
|
234 | [
|
235 | _c(
|
236 | "div",
|
237 | {
|
238 | directives: [
|
239 | {
|
240 | name: "show",
|
241 | rawName: "v-show",
|
242 | value: _vm.visible,
|
243 | expression: "visible"
|
244 | }
|
245 | ],
|
246 | class: [
|
247 | "el-message",
|
248 | _vm.type && !_vm.iconClass ? "el-message--" + _vm.type : "",
|
249 | _vm.center ? "is-center" : "",
|
250 | _vm.showClose ? "is-closable" : "",
|
251 | _vm.customClass
|
252 | ],
|
253 | style: _vm.positionStyle,
|
254 | attrs: { role: "alert" },
|
255 | on: { mouseenter: _vm.clearTimer, mouseleave: _vm.startTimer }
|
256 | },
|
257 | [
|
258 | _vm.iconClass
|
259 | ? _c("i", { class: _vm.iconClass })
|
260 | : _c("i", { class: _vm.typeClass }),
|
261 | _vm._t("default", [
|
262 | !_vm.dangerouslyUseHTMLString
|
263 | ? _c("p", { staticClass: "el-message__content" }, [
|
264 | _vm._v(_vm._s(_vm.message))
|
265 | ])
|
266 | : _c("p", {
|
267 | staticClass: "el-message__content",
|
268 | domProps: { innerHTML: _vm._s(_vm.message) }
|
269 | })
|
270 | ]),
|
271 | _vm.showClose
|
272 | ? _c("i", {
|
273 | staticClass: "el-message__closeBtn el-icon-close",
|
274 | on: { click: _vm.close }
|
275 | })
|
276 | : _vm._e()
|
277 | ],
|
278 | 2
|
279 | )
|
280 | ]
|
281 | )
|
282 | }
|
283 | var staticRenderFns = []
|
284 | render._withStripped = true
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 | var typeMap = {
|
318 | success: 'success',
|
319 | info: 'info',
|
320 | warning: 'warning',
|
321 | error: 'error'
|
322 | };
|
323 |
|
324 | var mainvue_type_script_lang_js_ = ({
|
325 | data: function data() {
|
326 | return {
|
327 | visible: false,
|
328 | message: '',
|
329 | duration: 3000,
|
330 | type: 'info',
|
331 | iconClass: '',
|
332 | customClass: '',
|
333 | onClose: null,
|
334 | showClose: false,
|
335 | closed: false,
|
336 | verticalOffset: 20,
|
337 | timer: null,
|
338 | dangerouslyUseHTMLString: false,
|
339 | center: false
|
340 | };
|
341 | },
|
342 |
|
343 |
|
344 | computed: {
|
345 | typeClass: function typeClass() {
|
346 | return this.type && !this.iconClass ? 'el-message__icon el-icon-' + typeMap[this.type] : '';
|
347 | },
|
348 | positionStyle: function positionStyle() {
|
349 | return {
|
350 | 'top': this.verticalOffset + 'px'
|
351 | };
|
352 | }
|
353 | },
|
354 |
|
355 | watch: {
|
356 | closed: function closed(newVal) {
|
357 | if (newVal) {
|
358 | this.visible = false;
|
359 | }
|
360 | }
|
361 | },
|
362 |
|
363 | methods: {
|
364 | handleAfterLeave: function handleAfterLeave() {
|
365 | this.$destroy(true);
|
366 | this.$el.parentNode.removeChild(this.$el);
|
367 | },
|
368 | close: function close() {
|
369 | this.closed = true;
|
370 | if (typeof this.onClose === 'function') {
|
371 | this.onClose(this);
|
372 | }
|
373 | },
|
374 | clearTimer: function clearTimer() {
|
375 | clearTimeout(this.timer);
|
376 | },
|
377 | startTimer: function startTimer() {
|
378 | var _this = this;
|
379 |
|
380 | if (this.duration > 0) {
|
381 | this.timer = setTimeout(function () {
|
382 | if (!_this.closed) {
|
383 | _this.close();
|
384 | }
|
385 | }, this.duration);
|
386 | }
|
387 | },
|
388 | keydown: function keydown(e) {
|
389 | if (e.keyCode === 27) {
|
390 |
|
391 | if (!this.closed) {
|
392 | this.close();
|
393 | }
|
394 | }
|
395 | }
|
396 | },
|
397 | mounted: function mounted() {
|
398 | this.startTimer();
|
399 | document.addEventListener('keydown', this.keydown);
|
400 | },
|
401 | beforeDestroy: function beforeDestroy() {
|
402 | document.removeEventListener('keydown', this.keydown);
|
403 | }
|
404 | });
|
405 |
|
406 | var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
|
407 |
|
408 | var componentNormalizer = __webpack_require__(0);
|
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 | var component = Object(componentNormalizer["a" ])(
|
419 | src_mainvue_type_script_lang_js_,
|
420 | render,
|
421 | staticRenderFns,
|
422 | false,
|
423 | null,
|
424 | null,
|
425 | null
|
426 |
|
427 | )
|
428 |
|
429 |
|
430 | if (false) { var api; }
|
431 | component.options.__file = "packages/message/src/main.vue"
|
432 | var main = (component.exports);
|
433 |
|
434 | var popup_ = __webpack_require__(15);
|
435 |
|
436 |
|
437 | var vdom_ = __webpack_require__(23);
|
438 |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 |
|
444 | var MessageConstructor = external_vue_default.a.extend(main);
|
445 |
|
446 | var instance = void 0;
|
447 | var instances = [];
|
448 | var seed = 1;
|
449 |
|
450 | var main_Message = function Message(options) {
|
451 | if (external_vue_default.a.prototype.$isServer) return;
|
452 | options = options || {};
|
453 | if (typeof options === 'string') {
|
454 | options = {
|
455 | message: options
|
456 | };
|
457 | }
|
458 | var userOnClose = options.onClose;
|
459 | var id = 'message_' + seed++;
|
460 |
|
461 | options.onClose = function () {
|
462 | Message.close(id, userOnClose);
|
463 | };
|
464 | instance = new MessageConstructor({
|
465 | data: options
|
466 | });
|
467 | instance.id = id;
|
468 | if (Object(vdom_["isVNode"])(instance.message)) {
|
469 | instance.$slots.default = [instance.message];
|
470 | instance.message = null;
|
471 | }
|
472 | instance.$mount();
|
473 | document.body.appendChild(instance.$el);
|
474 | var verticalOffset = options.offset || 20;
|
475 | instances.forEach(function (item) {
|
476 | verticalOffset += item.$el.offsetHeight + 16;
|
477 | });
|
478 | instance.verticalOffset = verticalOffset;
|
479 | instance.visible = true;
|
480 | instance.$el.style.zIndex = popup_["PopupManager"].nextZIndex();
|
481 | instances.push(instance);
|
482 | return instance;
|
483 | };
|
484 |
|
485 | ['success', 'warning', 'info', 'error'].forEach(function (type) {
|
486 | main_Message[type] = function (options) {
|
487 | if (typeof options === 'string') {
|
488 | options = {
|
489 | message: options
|
490 | };
|
491 | }
|
492 | options.type = type;
|
493 | return main_Message(options);
|
494 | };
|
495 | });
|
496 |
|
497 | main_Message.close = function (id, userOnClose) {
|
498 | var len = instances.length;
|
499 | var index = -1;
|
500 | var removedHeight = void 0;
|
501 | for (var i = 0; i < len; i++) {
|
502 | if (id === instances[i].id) {
|
503 | removedHeight = instances[i].$el.offsetHeight;
|
504 | index = i;
|
505 | if (typeof userOnClose === 'function') {
|
506 | userOnClose(instances[i]);
|
507 | }
|
508 | instances.splice(i, 1);
|
509 | break;
|
510 | }
|
511 | }
|
512 | if (len <= 1 || index === -1 || index > instances.length - 1) return;
|
513 | for (var _i = index; _i < len - 1; _i++) {
|
514 | var dom = instances[_i].$el;
|
515 | dom.style['top'] = parseInt(dom.style['top'], 10) - removedHeight - 16 + 'px';
|
516 | }
|
517 | };
|
518 |
|
519 | main_Message.closeAll = function () {
|
520 | for (var i = instances.length - 1; i >= 0; i--) {
|
521 | instances[i].close();
|
522 | }
|
523 | };
|
524 |
|
525 | var src_main = (main_Message);
|
526 |
|
527 |
|
528 | var message = __webpack_exports__["default"] = (src_main);
|
529 |
|
530 | })
|
531 |
|
532 | }); |
\ | No newline at end of file |