Commit 2ef1b05f4d7cbb9c855024f1540c5661e060be74

Authored by 梁灏
1 parent 5fe59e3a

Cell add globl setting #5592

examples/routers/cell.vue
... ... @@ -3,7 +3,7 @@
3 3 <Card title="选项" :padding="0" shadow style="width: 300px;">
4 4 <CellGroup @on-click="handleClick">
5 5 <Cell title="标题一" name="a1" label="附属内容" to="/button">
6   - <Badge count="10" slot="extra"></Badge>
  6 + <Badge :count="10" slot="extra"></Badge>
7 7 </Cell>
8 8 <Cell title="标题一" name="a2" label="附属内容" extra="详细信息"></Cell>
9 9 <Cell title="标题一" name="a3" label="附属内容" extra="详细信息" to="/button"></Cell>
... ...
src/components/cell/cell.vue
... ... @@ -25,7 +25,7 @@
25 25 </div>
26 26 <div class="ivu-cell-arrow" v-if="to">
27 27 <slot name="arrow">
28   - <Icon type="ios-arrow-forward"></Icon>
  28 + <Icon :type="arrowType" :custom="customArrowType" :size="arrowSize" />
29 29 </slot>
30 30 </div>
31 31 </div>
... ... @@ -83,6 +83,41 @@
83 83 }
84 84 ];
85 85 },
  86 + // 3.4.0, global setting customArrow 有值时,arrow 赋值空
  87 + arrowType () {
  88 + let type = 'ios-arrow-forward';
  89 +
  90 + if (this.$IVIEW) {
  91 + if (this.$IVIEW.cell.customArrow) {
  92 + type = '';
  93 + } else if (this.$IVIEW.cell.arrow) {
  94 + type = this.$IVIEW.cell.arrow;
  95 + }
  96 + }
  97 + return type;
  98 + },
  99 + // 3.4.0, global setting
  100 + customArrowType () {
  101 + let type = '';
  102 +
  103 + if (this.$IVIEW) {
  104 + if (this.$IVIEW.cell.customArrow) {
  105 + type = this.$IVIEW.cell.customArrow;
  106 + }
  107 + }
  108 + return type;
  109 + },
  110 + // 3.4.0, global setting
  111 + arrowSize () {
  112 + let size = '';
  113 +
  114 + if (this.$IVIEW) {
  115 + if (this.$IVIEW.cell.arrowSize) {
  116 + size = this.$IVIEW.cell.arrowSize;
  117 + }
  118 + }
  119 + return size;
  120 + }
86 121 },
87 122 methods: {
88 123 handleClickItem (event, new_window) {
... ...
src/index.js
... ... @@ -170,9 +170,14 @@ const install = function(Vue, opts = {}) {
170 170 size: opts.size || '',
171 171 transfer: 'transfer' in opts ? opts.transfer : '',
172 172 select: {
173   - arrow: opts.select ? opts.select.arrow ? opts.select.arrow : '' : '', // 下拉箭头图标
174   - customArrow: opts.select ? opts.select.customArrow ? opts.select.customArrow : '' : '', // 自定义下拉箭头图标,优先显示
175   - arrowSize: opts.select ? opts.select.arrowSize ? opts.select.arrowSize : '' : '' // 下拉箭头字号
  173 + arrow: opts.select ? opts.select.arrow ? opts.select.arrow : '' : '',
  174 + customArrow: opts.select ? opts.select.customArrow ? opts.select.customArrow : '' : '',
  175 + arrowSize: opts.select ? opts.select.arrowSize ? opts.select.arrowSize : '' : ''
  176 + },
  177 + cell: {
  178 + arrow: opts.cell ? opts.cell.arrow ? opts.cell.arrow : '' : '',
  179 + customArrow: opts.cell ? opts.cell.customArrow ? opts.cell.customArrow : '' : '',
  180 + arrowSize: opts.cell ? opts.cell.arrowSize ? opts.cell.arrowSize : '' : ''
176 181 }
177 182 };
178 183  
... ...