update List

This commit is contained in:
梁灏 2019-06-08 15:53:25 +08:00
parent fb7f36f91b
commit c501f03c9d
4 changed files with 155 additions and 26 deletions

View file

@ -1,13 +1,36 @@
<template>
<li class="ivu-list-item">
<li class="ivu-list-item" :class="classes">
<slot></slot>
<ul class="ivu-list-item-action" v-if="$slots.action">
<slot name="action"></slot>
</ul>
</li>
</template>
<script>
export default {
name: 'ListItem',
inject: ['ListInstance'],
props: {
},
computed: {
isFlexMode () {
const extra = this.$slots.extra;
const itemLayout = this.ListInstance.itemLayout;
if (itemLayout === 'vertical') {
return !!extra;
}
return !this.$slots.default;
},
classes () {
return [
{
'ivu-list-item-no-flex': !this.isFlexMode
}
];
}
}
};
</script>

View file

@ -4,7 +4,7 @@
<div class="ivu-list-container">
<ul class="ivu-list-items"><slot></slot></ul>
</div>
<Spin v-if="loading"><slot name="spin"></slot></Spin>
<Spin v-if="loading" fix size="large"><slot name="spin"></slot></Spin>
<div class="ivu-list-footer" v-if="footer || $slots.footer"><slot name="footer">{{ footer }}</slot></div>
</div>
</template>
@ -15,6 +15,11 @@
export default {
name: 'List',
provide () {
return {
ListInstance: this
};
},
props: {
border: {
type: Boolean,

View file

@ -31,6 +31,7 @@
flex: 1 0;
}
&-title {
font-weight: bold;
margin-bottom: 4px;
color: @text-color;
font-size: @font-size-base;
@ -65,18 +66,28 @@
line-height: 22px;
text-align: center;
cursor: pointer;
&:after{
content: '';
position: absolute;
top: 50%;
right: 0;
width: 1px;
height: 14px;
margin-top: -7px;
background-color: @border-color-split;
}
}
& > li:first-child {
padding-left: 0;
}
& > li:last-child {
&:after{
display: none;
}
}
&-split {
position: absolute;
top: 50%;
right: 0;
width: 1px;
height: 14px;
margin-top: -7px;
background-color: @border-color-split;
}
}
}
@ -154,6 +165,20 @@
}
}
}
// without flex
&-item-no-flex {
display: block;
}
// Horizontal
&:not(.@{list-prefix-cls}-vertical) {
.@{list-prefix-cls}-item-no-flex {
.@{list-prefix-cls}-item-action {
float: right;
}
}
}
}
.@{list-prefix-cls}-bordered {