mirror of
https://github.com/iczer/vue-antd-admin.git
synced 2025-04-26 11:36:37 +08:00
增加属性layout、size、col支持
This commit is contained in:
parent
624e940bf3
commit
4a96457bab
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="detail-list">
|
<div :class="['detail-list', size === 'small' ? 'small' : 'large', layout === 'vertical' ? 'vertical': 'horizontal']">
|
||||||
<div v-if="title" class="title">{{title}}</div>
|
<div v-if="title" class="title">{{title}}</div>
|
||||||
<a-row>
|
<a-row>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
@ -18,6 +18,11 @@ const Item = {
|
|||||||
required: false
|
required: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
inject: {
|
||||||
|
col: {
|
||||||
|
type: Number
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
renderTerm (h, term) {
|
renderTerm (h, term) {
|
||||||
return h(
|
return h(
|
||||||
@ -48,21 +53,50 @@ const Item = {
|
|||||||
return h(
|
return h(
|
||||||
ACol,
|
ACol,
|
||||||
{
|
{
|
||||||
props: {
|
props: responsive[this.col]
|
||||||
xs: 24,
|
|
||||||
sm: 12,
|
|
||||||
md: 8
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
[term, content]
|
[term, content]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const responsive = {
|
||||||
|
1: { xs: 24 },
|
||||||
|
2: { xs: 24, sm: 12 },
|
||||||
|
3: { xs: 24, sm: 12, md: 8 },
|
||||||
|
4: { xs: 24, sm: 12, md: 6 }
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DetailList',
|
name: 'DetailList',
|
||||||
Item: Item,
|
Item: Item,
|
||||||
props: ['title'],
|
props: {
|
||||||
components: {ARow, ACol}
|
title: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
col: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
default: 3
|
||||||
|
},
|
||||||
|
size: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: 'large'
|
||||||
|
},
|
||||||
|
layout: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: 'horizontal'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {ARow, ACol},
|
||||||
|
provide () {
|
||||||
|
return {
|
||||||
|
col: this.col > 4 ? 4 : this.col
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -93,8 +127,26 @@ export default {
|
|||||||
line-height: 22px;
|
line-height: 22px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding-bottom: 16px;
|
padding-bottom: 16px;
|
||||||
color: rgba(0,0,0,.85);
|
color: rgba(0,0,0,.65);
|
||||||
display: table-cell;
|
display: table-cell;
|
||||||
}
|
}
|
||||||
|
&.small{
|
||||||
|
.term,.content{
|
||||||
|
padding-bottom: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.large{
|
||||||
|
.term,.content{
|
||||||
|
padding-bottom: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.vertical{
|
||||||
|
.term {
|
||||||
|
padding-bottom: 8px;
|
||||||
|
}
|
||||||
|
.term,.content{
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user