Cell add globl setting #5592

This commit is contained in:
梁灏 2019-04-09 17:59:33 +08:00
parent 5fe59e3ab2
commit 2ef1b05f4d
3 changed files with 45 additions and 5 deletions

View file

@ -3,7 +3,7 @@
<Card title="选项" :padding="0" shadow style="width: 300px;">
<CellGroup @on-click="handleClick">
<Cell title="标题一" name="a1" label="附属内容" to="/button">
<Badge count="10" slot="extra"></Badge>
<Badge :count="10" slot="extra"></Badge>
</Cell>
<Cell title="标题一" name="a2" label="附属内容" extra="详细信息"></Cell>
<Cell title="标题一" name="a3" label="附属内容" extra="详细信息" to="/button"></Cell>

View file

@ -25,7 +25,7 @@
</div>
<div class="ivu-cell-arrow" v-if="to">
<slot name="arrow">
<Icon type="ios-arrow-forward"></Icon>
<Icon :type="arrowType" :custom="customArrowType" :size="arrowSize" />
</slot>
</div>
</div>
@ -83,6 +83,41 @@
}
];
},
// 3.4.0, global setting customArrow arrow
arrowType () {
let type = 'ios-arrow-forward';
if (this.$IVIEW) {
if (this.$IVIEW.cell.customArrow) {
type = '';
} else if (this.$IVIEW.cell.arrow) {
type = this.$IVIEW.cell.arrow;
}
}
return type;
},
// 3.4.0, global setting
customArrowType () {
let type = '';
if (this.$IVIEW) {
if (this.$IVIEW.cell.customArrow) {
type = this.$IVIEW.cell.customArrow;
}
}
return type;
},
// 3.4.0, global setting
arrowSize () {
let size = '';
if (this.$IVIEW) {
if (this.$IVIEW.cell.arrowSize) {
size = this.$IVIEW.cell.arrowSize;
}
}
return size;
}
},
methods: {
handleClickItem (event, new_window) {

View file

@ -170,9 +170,14 @@ const install = function(Vue, opts = {}) {
size: opts.size || '',
transfer: 'transfer' in opts ? opts.transfer : '',
select: {
arrow: opts.select ? opts.select.arrow ? opts.select.arrow : '' : '', // 下拉箭头图标
customArrow: opts.select ? opts.select.customArrow ? opts.select.customArrow : '' : '', // 自定义下拉箭头图标,优先显示
arrowSize: opts.select ? opts.select.arrowSize ? opts.select.arrowSize : '' : '' // 下拉箭头字号
arrow: opts.select ? opts.select.arrow ? opts.select.arrow : '' : '',
customArrow: opts.select ? opts.select.customArrow ? opts.select.customArrow : '' : '',
arrowSize: opts.select ? opts.select.arrowSize ? opts.select.arrowSize : '' : ''
},
cell: {
arrow: opts.cell ? opts.cell.arrow ? opts.cell.arrow : '' : '',
customArrow: opts.cell ? opts.cell.customArrow ? opts.cell.customArrow : '' : '',
arrowSize: opts.cell ? opts.cell.arrowSize ? opts.cell.arrowSize : '' : ''
}
};