Fix warning: rowKey was not set in a-table component

pull/9/head
johnniang 2019-04-12 10:42:03 +08:00
parent 0c8dcea2b6
commit e7ee3b6d22
3 changed files with 98 additions and 27 deletions

View File

@ -74,6 +74,7 @@
:columns="columns"
:dataSource="menus"
:loading="loading"
:rowKey="menu => menu.id"
>
<ellipsis
:length="30"

View File

@ -1,24 +1,53 @@
<template>
<div class="page-header-index-wide">
<a-row>
<a-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
<a-col
:xl="24"
:lg="24"
:md="24"
:sm="24"
:xs="24"
>
<div class="card-container">
<a-tabs type="card">
<a-tab-pane tab="内置页面" key="internal">
<a-table :columns="internalColumns" :dataSource="internalPages" :pagination="false">
<span slot="action" slot-scope="text, record">
<a href="javascript:;" @click="viewPage(record.id)"></a>
<a-tab-pane
tab="内置页面"
key="internal"
>
<a-table
:columns="internalColumns"
:dataSource="internalPages"
:pagination="false"
:rowKey="page => page.id"
>
<span
slot="action"
slot-scope="text, record"
>
<a
href="javascript:;"
@click="viewPage(record.id)"
>查看</a>
<a-divider type="vertical" />
<router-link :to="{name:'LinkList'}" v-if="record.id==1">
<router-link
:to="{name:'LinkList'}"
v-if="record.id==1"
>
<a href="javascript:void(0);">编辑</a>
</router-link>
<router-link :to="{name:'GalleryList'}" v-if="record.id==2">
<router-link
:to="{name:'GalleryList'}"
v-if="record.id==2"
>
<a href="javascript:void(0);">编辑</a>
</router-link>
</span>
</a-table>
</a-tab-pane>
<a-tab-pane tab="自定义页面" key="custom">自定义页面</a-tab-pane>
<a-tab-pane
tab="自定义页面"
key="custom"
>自定义页面</a-tab-pane>
</a-tabs>
</div>
</a-col>

View File

@ -7,19 +7,26 @@
:md="10"
:sm="24"
:xs="24"
:style="{ 'padding-bottom': '12px' }">
:style="{ 'padding-bottom': '12px' }"
>
<a-card :title="title">
<a-form layout="horizontal">
<a-form-item label="网站名称:">
<a-input v-model="link.name" />
</a-form-item>
<a-form-item label="网站地址:" help="* 需要加上 http://">
<a-form-item
label="网站地址:"
help="* 需要加上 http://"
>
<a-input v-model="link.url" />
</a-form-item>
<a-form-item label="Logo">
<a-input v-model="link.logo" />
</a-form-item>
<a-form-item label="分组:" help="* 非必填">
<a-form-item
label="分组:"
help="* 非必填"
>
<a-input v-model="link.team" />
</a-form-item>
<a-form-item label="描述:">
@ -30,10 +37,21 @@
/>
</a-form-item>
<a-form-item>
<a-button type="primary" @click="createLink" v-if="formType==='create'"></a-button>
<a-button
type="primary"
@click="createLink"
v-if="formType==='create'"
>保存</a-button>
<a-button-group v-else>
<a-button type="primary" @click="updateLink"></a-button>
<a-button type="dashed" @click="addLink" v-if="formType==='update'"></a-button>
<a-button
type="primary"
@click="updateLink"
>更新</a-button>
<a-button
type="dashed"
@click="addLink"
v-if="formType==='update'"
>返回添加</a-button>
</a-button-group>
</a-form-item>
</a-form>
@ -45,15 +63,38 @@
:md="14"
:sm="24"
:xs="24"
:style="{ 'padding-bottom': '12px' }">
:style="{ 'padding-bottom': '12px' }"
>
<a-card title="所有友情链接">
<a-table :columns="columns" :dataSource="links" :loading="loading">
<template slot="url" slot-scope="text">
<a target="_blank" :href="text">{{ text }}</a>
<a-table
:columns="columns"
:dataSource="links"
:loading="loading"
:rowKey="link => link.id"
>
<template
slot="url"
slot-scope="text"
>
<a
target="_blank"
:href="text"
>{{ text }}</a>
</template>
<ellipsis :length="30" tooltip slot="name" slot-scope="text">{{ text }}</ellipsis>
<span slot="action" slot-scope="text, record">
<a href="javascript:;" @click="editLink(record.id)"></a>
<ellipsis
:length="30"
tooltip
slot="name"
slot-scope="text"
>{{ text }}</ellipsis>
<span
slot="action"
slot-scope="text, record"
>
<a
href="javascript:;"
@click="editLink(record.id)"
>编辑</a>
<a-divider type="vertical" />
<a-popconfirm
:title="'你确定要删除【' + record.name + '】链接?'"