Browse Source

fix: list rowkey #458

Sendya 5 years ago
parent
commit
7a940d8821
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/views/list/CardList.vue

+ 4 - 2
src/views/list/CardList.vue

@@ -1,11 +1,12 @@
 <template>
   <div class="card-list" ref="content">
     <a-list
+      rowKey="id"
       :grid="{gutter: 24, lg: 3, md: 2, sm: 1, xs: 1}"
       :dataSource="dataSource"
     >
       <a-list-item slot="renderItem" slot-scope="item">
-        <template v-if="item === null">
+        <template v-if="!item || item.id === undefined">
           <a-button class="new-btn" type="dashed">
             <a-icon type="plus"/>
             新增产品
@@ -32,9 +33,10 @@
 <script>
 
 const dataSource = []
-dataSource.push(null)
+dataSource.push({})
 for (let i = 0; i < 11; i++) {
   dataSource.push({
+    id: i,
     title: 'Alipay',
     avatar: 'https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png',
     content: '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。'