Browse Source

fix 一个小问题

Michael Wang 3 years ago
parent
commit
f0ceaf3779
1 changed files with 5 additions and 5 deletions
  1. 5 5
      src/components/QmButton.vue

+ 5 - 5
src/components/QmButton.vue

@@ -1,10 +1,10 @@
 <template>
-  <!-- TODO: 应该用注释的这段代码的,但是从 vue 3.1.5 升级到 3.2.1 时这里出错了 -->
-  <!-- <template v-for="(_, slot) of $slots" v-slot:[slot]="scope">
-      <slot :name="slot" v-bind="scope" />
-    </template> -->
+  <!-- FIXED: 从 vue 3.1.5 升级到 3.2.1 时这里出错了,slot也要有key -->
   <a-button v-bind="newAttrs" :loading="inInterval" @click="insideClick">
-    <slot name="default" />
+    <template v-for="(_, slot) of $slots" v-slot:[slot]="scope">
+      <slot :name="slot" v-bind="scope" :key="slot" />
+    </template>
+    <!-- <slot name="default" /> -->
   </a-button>
 </template>