update the master branch to the latest
This commit is contained in:
parent
67d534df27
commit
23a0ba9831
611 changed files with 122648 additions and 0 deletions
8
src/components/list/index.js
Normal file
8
src/components/list/index.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
import List from './list.vue';
|
||||
import ListItem from './list-item.vue';
|
||||
import ListItemMeta from './list-item-meta.vue';
|
||||
|
||||
List.Item = ListItem;
|
||||
List.Item.Meta = ListItemMeta;
|
||||
|
||||
export default List;
|
35
src/components/list/list-item-meta.vue
Normal file
35
src/components/list/list-item-meta.vue
Normal file
|
@ -0,0 +1,35 @@
|
|||
<template>
|
||||
<div class="ivu-list-item-meta">
|
||||
<div class="ivu-list-item-meta-avatar" v-if="avatar || $slots.avatar">
|
||||
<slot name="avatar">
|
||||
<Avatar :src="avatar" />
|
||||
</slot>
|
||||
</div>
|
||||
<div class="ivu-list-item-meta-content">
|
||||
<div v-if="title || $slots.title" class="ivu-list-item-meta-title"><slot name="title">{{ title }}</slot></div>
|
||||
<div v-if="description || $slots.description" class="ivu-list-item-meta-description"><slot name="description">{{ description }}</slot></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import Avatar from '../../components/avatar/avatar.vue';
|
||||
|
||||
export default {
|
||||
name: 'ListItemMeta',
|
||||
components: { Avatar },
|
||||
props: {
|
||||
avatar: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
63
src/components/list/list-item.vue
Normal file
63
src/components/list/list-item.vue
Normal file
|
@ -0,0 +1,63 @@
|
|||
<template>
|
||||
<li class="ivu-list-item" :class="classes">
|
||||
<template v-if="itemLayout === 'vertical' && $slots.extra">
|
||||
<div class="ivu-list-item-main">
|
||||
<slot></slot>
|
||||
<ul class="ivu-list-item-action" v-if="$slots.action">
|
||||
<slot name="action"></slot>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ivu-list-item-extra">
|
||||
<slot name="extra"></slot>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<slot></slot>
|
||||
<ul class="ivu-list-item-action" v-if="$slots.action">
|
||||
<slot name="action"></slot>
|
||||
</ul>
|
||||
<div class="ivu-list-item-extra">
|
||||
<slot name="extra"></slot>
|
||||
</div>
|
||||
</template>
|
||||
</li>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'ListItem',
|
||||
inject: ['ListInstance'],
|
||||
props: {
|
||||
|
||||
},
|
||||
computed: {
|
||||
itemLayout () {
|
||||
return this.ListInstance.itemLayout;
|
||||
},
|
||||
isItemContainsTextNode () {
|
||||
let result;
|
||||
this.$slots.default.forEach(item => {
|
||||
if (typeof item === 'string') {
|
||||
result = true;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
},
|
||||
isFlexMode () {
|
||||
const extra = this.$slots.extra;
|
||||
|
||||
if (this.itemLayout === 'vertical') {
|
||||
return !!extra;
|
||||
}
|
||||
|
||||
return !this.isItemContainsTextNode;
|
||||
},
|
||||
classes () {
|
||||
return [
|
||||
{
|
||||
'ivu-list-item-no-flex': !this.isFlexMode
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
84
src/components/list/list.vue
Normal file
84
src/components/list/list.vue
Normal file
|
@ -0,0 +1,84 @@
|
|||
<template>
|
||||
<div :class="classes">
|
||||
<div class="ivu-list-header" v-if="header || $slots.header"><slot name="header">{{ header }}</slot></div>
|
||||
<div class="ivu-list-container">
|
||||
<ul class="ivu-list-items"><slot></slot></ul>
|
||||
</div>
|
||||
<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>
|
||||
<script>
|
||||
import { oneOf } from '../../utils/assist';
|
||||
|
||||
const prefixCls = 'ivu-list';
|
||||
|
||||
export default {
|
||||
name: 'List',
|
||||
provide () {
|
||||
return {
|
||||
ListInstance: this
|
||||
};
|
||||
},
|
||||
props: {
|
||||
border: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
itemLayout: {
|
||||
validator (value) {
|
||||
return oneOf(value, ['horizontal', 'vertical']);
|
||||
},
|
||||
default: 'horizontal'
|
||||
},
|
||||
// 或 slot
|
||||
header: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 或 slot
|
||||
footer: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 含 slot: spin
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
size: {
|
||||
validator (value) {
|
||||
return oneOf(value, ['small', 'large', 'default']);
|
||||
},
|
||||
default () {
|
||||
return !this.$IVIEW || this.$IVIEW.size === '' ? 'default' : this.$IVIEW.size;
|
||||
}
|
||||
},
|
||||
split: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
classes () {
|
||||
return [
|
||||
`${prefixCls}`,
|
||||
`${prefixCls}-${this.size}`,
|
||||
`${prefixCls}-${this.itemLayout}`,
|
||||
{
|
||||
[`${prefixCls}-bordered`]: this.border,
|
||||
[`${prefixCls}-split`]: this.split
|
||||
}
|
||||
];
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue