Browse Source

feat: extra props for buttons in toasts

tophf 2 years ago
parent
commit
c49a687d2d
1 changed files with 6 additions and 6 deletions
  1. 6 6
      src/common/ui/message.vue

+ 6 - 6
src/common/ui/message.vue

@@ -15,11 +15,12 @@
       <!-- eslint-enable vue/no-mutating-props -->
       <!-- eslint-enable vue/no-mutating-props -->
       <div class="mr-1c">
       <div class="mr-1c">
         <button
         <button
-          v-for="(button, index) in message.buttons"
+          v-for="({text, type, onClick, ...extras}, index) in message.buttons"
           :key="index"
           :key="index"
-          :type="button.type || 'button'"
-          v-text="button.text"
-          @click="onButtonClick(button)"
+          :type="type || 'button'"
+          v-text="text"
+          v-bind="extras"
+          @click="onButtonClick(onClick)"
         />
         />
       </div>
       </div>
     </form>
     </form>
@@ -47,8 +48,7 @@ export default {
       dismissers.length = 0;
       dismissers.length = 0;
       context.emit('dismiss');
       context.emit('dismiss');
     };
     };
-    const onButtonClick = button => {
-      const { onClick } = button;
+    const onButtonClick = onClick => {
       if (onClick) {
       if (onClick) {
         if (onClick(props.message.input) !== false) dismiss();
         if (onClick(props.message.input) !== false) dismiss();
       }
       }