Commit 5fe59e3ab2bfb75cf60934de16152f6063147164

Authored by 梁灏
1 parent b265d611

select add global setting #5592

src/components/select/select-head.vue
@@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
39 39
40 ref="input"> 40 ref="input">
41 <Icon type="ios-close-circle" :class="[prefixCls + '-arrow']" v-if="resetSelect" @click.native.stop="onClear"></Icon> 41 <Icon type="ios-close-circle" :class="[prefixCls + '-arrow']" v-if="resetSelect" @click.native.stop="onClear"></Icon>
42 - <Icon type="ios-arrow-down" :class="[prefixCls + '-arrow']" v-if="!resetSelect && !remote"></Icon> 42 + <Icon :type="arrowType" :custom="customArrowType" :size="arrowSize" :class="[prefixCls + '-arrow']" v-if="!resetSelect && !remote"></Icon>
43 </div> 43 </div>
44 </template> 44 </template>
45 <script> 45 <script>
@@ -174,6 +174,41 @@ @@ -174,6 +174,41 @@
174 return { 174 return {
175 [`${prefixCls}-head-flex`]: this.filterable && (this.$slots.prefix || this.prefix) 175 [`${prefixCls}-head-flex`]: this.filterable && (this.$slots.prefix || this.prefix)
176 }; 176 };
  177 + },
  178 + // 3.4.0, global setting customArrow 有值时,arrow 赋值空
  179 + arrowType () {
  180 + let type = 'ios-arrow-down';
  181 +
  182 + if (this.$IVIEW) {
  183 + if (this.$IVIEW.select.customArrow) {
  184 + type = '';
  185 + } else if (this.$IVIEW.select.arrow) {
  186 + type = this.$IVIEW.select.arrow;
  187 + }
  188 + }
  189 + return type;
  190 + },
  191 + // 3.4.0, global setting
  192 + customArrowType () {
  193 + let type = '';
  194 +
  195 + if (this.$IVIEW) {
  196 + if (this.$IVIEW.select.customArrow) {
  197 + type = this.$IVIEW.select.customArrow;
  198 + }
  199 + }
  200 + return type;
  201 + },
  202 + // 3.4.0, global setting
  203 + arrowSize () {
  204 + let size = '';
  205 +
  206 + if (this.$IVIEW) {
  207 + if (this.$IVIEW.select.arrowSize) {
  208 + size = this.$IVIEW.select.arrowSize;
  209 + }
  210 + }
  211 + return size;
177 } 212 }
178 }, 213 },
179 methods: { 214 methods: {
@@ -168,7 +168,12 @@ const install = function(Vue, opts = {}) { @@ -168,7 +168,12 @@ const install = function(Vue, opts = {}) {
168 168
169 Vue.prototype.$IVIEW = { 169 Vue.prototype.$IVIEW = {
170 size: opts.size || '', 170 size: opts.size || '',
171 - transfer: 'transfer' in opts ? opts.transfer : '' 171 + transfer: 'transfer' in opts ? opts.transfer : '',
  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 : '' : '' // 下拉箭头字号
  176 + }
172 }; 177 };
173 178
174 Vue.prototype.$Loading = LoadingBar; 179 Vue.prototype.$Loading = LoadingBar;
src/styles/components/select.less
@@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
43 } 43 }
44 44
45 .@{select-prefix-cls}-arrow { 45 .@{select-prefix-cls}-arrow {
46 - transform: rotate(180deg); 46 + transform: translateY(-50%) rotate(180deg);
47 display: inline-block; 47 display: inline-block;
48 } 48 }
49 } 49 }
src/styles/mixins/common.less
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 top: 50%; 20 top: 50%;
21 right: 8px; 21 right: 8px;
22 line-height: 1; 22 line-height: 1;
23 - margin-top: -7px; 23 + transform: translateY(-50%);
24 font-size: @font-size-base; 24 font-size: @font-size-base;
25 color: @subsidiary-color; 25 color: @subsidiary-color;
26 transition: all @transition-time @ease-in-out; 26 transition: all @transition-time @ease-in-out;