Explorar o código

MessageBox: reject all cancel actions

Leopoldthecoder %!s(int64=8) %!d(string=hai) anos
pai
achega
0137e5b80a
Modificáronse 3 ficheiros con 9 adicións e 14 borrados
  1. 1 1
      examples/docs/en-US/tag.md
  2. 1 1
      examples/docs/zh-CN/tag.md
  3. 7 12
      packages/message-box/src/main.js

+ 1 - 1
examples/docs/en-US/tag.md

@@ -179,7 +179,7 @@ You can use the `close` event to add and remove tag dynamically.
 |---------- |-------------- |---------- |--------------------------------  |-------- |
 | type | theme | string | primary/gray/success/warning/danger | — |
 | closable | whether Tab can be removed | boolean | — | false |
-| close-transition | whether the removal animation is disabled | boolean | — | false |
+| close-transition | whether to disable animations | boolean | — | false |
 | hit | whether Tag has a highlighted border | boolean | — | false |
 | color | background color of the tag | string | — | — |
 

+ 1 - 1
examples/docs/zh-CN/tag.md

@@ -179,7 +179,7 @@
 |---------- |-------------- |---------- |--------------------------------  |-------- |
 | type | 主题 | string | primary/gray/success/warning/danger | — |
 | closable | 是否可关闭 | boolean | — | false |
-| close-transition | 是否禁用关闭时的渐变动画 | boolean | — | false |
+| close-transition | 是否禁用渐变动画 | boolean | — | false |
 | hit | 是否有边框描边 | boolean | — | false |
 | color | 背景色 | string | — | — |
 

+ 7 - 12
packages/message-box/src/main.js

@@ -47,19 +47,14 @@ const defaultCallback = action => {
       }
     }
     if (currentMsg.resolve) {
-      let $type = currentMsg.options.$type;
-      if ($type === 'confirm' || $type === 'prompt') {
-        if (action === 'confirm') {
-          if (instance.showInput) {
-            currentMsg.resolve({ value: instance.inputValue, action });
-          } else {
-            currentMsg.resolve(action);
-          }
-        } else if (action === 'cancel' && currentMsg.reject) {
-          currentMsg.reject(action);
+      if (action === 'confirm') {
+        if (instance.showInput) {
+          currentMsg.resolve({ value: instance.inputValue, action });
+        } else {
+          currentMsg.resolve(action);
         }
-      } else {
-        currentMsg.resolve(action);
+      } else if (action === 'cancel' && currentMsg.reject) {
+        currentMsg.reject(action);
       }
     }
   }