fixed #704
This commit is contained in:
parent
4fffb066ab
commit
300bd6623e
3 changed files with 71 additions and 11 deletions
|
@ -1,31 +1,74 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<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="handleClear">clear</Button>
|
||||||
|
<Button @click="loading = !loading">Loading</Button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
loading: false,
|
||||||
columns3: [
|
columns3: [
|
||||||
{
|
|
||||||
type: 'index',
|
|
||||||
width: 60,
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: '姓名',
|
title: '姓名',
|
||||||
key: 'name'
|
key: 'name',
|
||||||
|
width: 100,
|
||||||
|
fixed: 'left'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '年龄',
|
title: '年龄',
|
||||||
key: 'age',
|
key: 'age',
|
||||||
sortable: true
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '省份',
|
||||||
|
key: 'province',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '市区',
|
||||||
|
key: 'city',
|
||||||
|
width: 100
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '地址',
|
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: [
|
data1: [
|
||||||
|
|
|
@ -82,11 +82,15 @@
|
||||||
</div>
|
</div>
|
||||||
<div :class="[prefixCls + '-footer']" v-if="showSlotFooter" ref="footer"><slot name="footer"></slot></div>
|
<div :class="[prefixCls + '-footer']" v-if="showSlotFooter" ref="footer"><slot name="footer"></slot></div>
|
||||||
</div>
|
</div>
|
||||||
|
<Spin fix size="large" v-if="loading">
|
||||||
|
<slot name="loading"></slot>
|
||||||
|
</Spin>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import tableHead from './table-head.vue';
|
import tableHead from './table-head.vue';
|
||||||
import tableBody from './table-body.vue';
|
import tableBody from './table-body.vue';
|
||||||
|
import Spin from '../spin/spin.vue';
|
||||||
import { oneOf, getStyle, deepCopy, getScrollBarSize } from '../../utils/assist';
|
import { oneOf, getStyle, deepCopy, getScrollBarSize } from '../../utils/assist';
|
||||||
import { on, off } from '../../utils/dom';
|
import { on, off } from '../../utils/dom';
|
||||||
import Csv from '../../utils/csv';
|
import Csv from '../../utils/csv';
|
||||||
|
@ -101,7 +105,7 @@
|
||||||
export default {
|
export default {
|
||||||
name: 'Table',
|
name: 'Table',
|
||||||
mixins: [ Locale ],
|
mixins: [ Locale ],
|
||||||
components: { tableHead, tableBody },
|
components: { tableHead, tableBody, Spin },
|
||||||
props: {
|
props: {
|
||||||
data: {
|
data: {
|
||||||
type: Array,
|
type: Array,
|
||||||
|
@ -159,6 +163,10 @@
|
||||||
},
|
},
|
||||||
disabledHover: {
|
disabledHover: {
|
||||||
type: Boolean
|
type: Boolean
|
||||||
|
},
|
||||||
|
loading: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: @zindex-spin;
|
z-index: @zindex-spin;
|
||||||
.square(100%);
|
.square(100%);
|
||||||
background-color: rgba(255,255,255,.95);
|
background-color: rgba(255,255,255,.9);
|
||||||
}
|
}
|
||||||
|
|
||||||
&-fix &-main {
|
&-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 {
|
@keyframes ani-spin-bounce {
|
||||||
0% {
|
0% {
|
||||||
transform: scale(0);
|
transform: scale(0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue