|
1 | 1 | // Object.assign Polyfill
|
2 | 2 | if (typeof Object.assign != 'function') {
|
3 |
| - Object.assign = function(target) { |
4 |
| - 'use strict'; |
5 |
| - if (target == null) { |
6 |
| - throw new TypeError('Cannot convert undefined or null to object'); |
7 |
| - } |
| 3 | + Object.assign = function (target) { |
| 4 | + 'use strict'; |
| 5 | + if (target == null) { |
| 6 | + throw new TypeError('Cannot convert undefined or null to object'); |
| 7 | + } |
8 | 8 |
|
9 |
| - target = Object(target); |
10 |
| - for (var index = 1; index < arguments.length; index++) { |
11 |
| - var source = arguments[index]; |
12 |
| - if (source != null) { |
13 |
| - for (var key in source) { |
14 |
| - if (Object.prototype.hasOwnProperty.call(source, key)) { |
15 |
| - target[key] = source[key]; |
16 |
| - } |
| 9 | + target = Object(target); |
| 10 | + for (var index = 1; index < arguments.length; index++) { |
| 11 | + var source = arguments[index]; |
| 12 | + if (source != null) { |
| 13 | + for (var key in source) { |
| 14 | + if (Object.prototype.hasOwnProperty.call(source, key)) { |
| 15 | + target[key] = source[key]; |
| 16 | + } |
| 17 | + } |
| 18 | + } |
17 | 19 | }
|
18 |
| - } |
19 |
| - } |
20 |
| - return target; |
21 |
| - }; |
| 20 | + return target; |
| 21 | + }; |
22 | 22 | }
|
23 | 23 |
|
24 | 24 | // Promise Polyfill Auto
|
25 |
| -require('es6-promise').polyfill(); |
26 |
| -require('es6-promise/auto'); |
| 25 | +var Promise = require('es6-promise').Promise; |
27 | 26 |
|
28 | 27 | var Modal = {
|
29 | 28 | /**
|
@@ -73,30 +72,26 @@ var Modal = {
|
73 | 72 | */
|
74 | 73 | modals[v] = options => {
|
75 | 74 | return new Promise((resolve, reject) => {
|
76 |
| - try { |
77 |
| - new Vue({ |
78 |
| - render: h => h(defaultOptions.modals[v], { |
79 |
| - props: options, |
80 |
| - style: Object.assign(defaultOptions.style, { |
81 |
| - zIndex: this.zIndex |
82 |
| - }), |
83 |
| - on: { |
84 |
| - $ok: function ($el, info) { |
85 |
| - $el.remove() |
86 |
| - resolve(info) |
87 |
| - }, |
88 |
| - $cancel: function ($el, info) { |
89 |
| - $el.remove() |
90 |
| - reject(info) |
91 |
| - } |
| 75 | + new Vue({ |
| 76 | + render: h => h(defaultOptions.modals[v], { |
| 77 | + props: options, |
| 78 | + style: Object.assign(defaultOptions.style, { |
| 79 | + zIndex: this.zIndex |
| 80 | + }), |
| 81 | + on: { |
| 82 | + $ok: function ($el, info) { |
| 83 | + $el.remove() |
| 84 | + resolve(info) |
| 85 | + }, |
| 86 | + $cancel: function ($el, info) { |
| 87 | + $el.remove() |
| 88 | + reject(info) |
92 | 89 | }
|
93 |
| - }) |
94 |
| - }).$mount('#' + defaultOptions.id) |
95 |
| - this.zIndex += 5; |
96 |
| - this.init(defaultOptions.id); |
97 |
| - } catch (error) { |
98 |
| - console.error('vuejs-modal', error) |
99 |
| - } |
| 90 | + } |
| 91 | + }) |
| 92 | + }).$mount('#' + defaultOptions.id) |
| 93 | + this.zIndex += 5; |
| 94 | + this.init(defaultOptions.id); |
100 | 95 |
|
101 | 96 | })
|
102 | 97 | }
|
|
0 commit comments