This commit is contained in:
梁灏 2017-09-18 18:41:24 +08:00
parent 4fffb066ab
commit 300bd6623e
3 changed files with 71 additions and 11 deletions

View file

@ -1,31 +1,74 @@
<template>
<div>
<Table highlight-row :columns="columns3" :data="data1" ref="table" @on-current-change="handleChange" @on-row-click="rc"></Table>
<Table width="550" height="200" highlight-row :loading="loading" :columns="columns3" :data="data1" ref="table" @on-current-change="handleChange" @on-row-click="rc">
<div slot="loading">
<Icon type="load-c" size=18 class="demo-spin-icon-load"></Icon>
<div>Loading</div>
</div>
</Table>
<br><br>
<Button @click="handleClear">clear</Button>
<Button @click="loading = !loading">Loading</Button>
</div>
</template>
<script>
export default {
data () {
return {
loading: false,
columns3: [
{
type: 'index',
width: 60,
align: 'center'
},
{
title: '姓名',
key: 'name'
key: 'name',
width: 100,
fixed: 'left'
},
{
title: '年龄',
key: 'age',
sortable: true
width: 100
},
{
title: '省份',
key: 'province',
width: 100
},
{
title: '市区',
key: 'city',
width: 100
},
{
title: '地址',
key: 'address'
key: 'address',
width: 200
},
{
title: '邮编',
key: 'zip',
width: 100
},
{
title: '操作',
key: 'action',
fixed: 'right',
width: 120,
render: (h, params) => {
return h('div', [
h('Button', {
props: {
type: 'text',
size: 'small'
}
}, '查看'),
h('Button', {
props: {
type: 'text',
size: 'small'
}
}, '编辑')
]);
}
}
],
data1: [

View file

@ -82,11 +82,15 @@
</div>
<div :class="[prefixCls + '-footer']" v-if="showSlotFooter" ref="footer"><slot name="footer"></slot></div>
</div>
<Spin fix size="large" v-if="loading">
<slot name="loading"></slot>
</Spin>
</div>
</template>
<script>
import tableHead from './table-head.vue';
import tableBody from './table-body.vue';
import Spin from '../spin/spin.vue';
import { oneOf, getStyle, deepCopy, getScrollBarSize } from '../../utils/assist';
import { on, off } from '../../utils/dom';
import Csv from '../../utils/csv';
@ -101,7 +105,7 @@
export default {
name: 'Table',
mixins: [ Locale ],
components: { tableHead, tableBody },
components: { tableHead, tableBody, Spin },
props: {
data: {
type: Array,
@ -159,6 +163,10 @@
},
disabledHover: {
type: Boolean
},
loading: {
type: Boolean,
default: false
}
},
data () {

View file

@ -31,7 +31,7 @@
left: 0;
z-index: @zindex-spin;
.square(100%);
background-color: rgba(255,255,255,.95);
background-color: rgba(255,255,255,.9);
}
&-fix &-main {
@ -56,6 +56,15 @@
}
}
// use in Table loading, Table right border is not included in .ivu-table-wrapper, so fix it
.@{table-prefix-cls}-wrapper{
> .@{spin-prefix-cls}-fix{
border: 1px solid @border-color-base;
border-top: 0;
border-left: 0;
}
}
@keyframes ani-spin-bounce {
0% {
transform: scale(0);