select add global setting #5592

This commit is contained in:
梁灏 2019-04-09 17:17:47 +08:00
parent b265d61178
commit 5fe59e3ab2
4 changed files with 44 additions and 4 deletions

View file

@ -39,7 +39,7 @@
ref="input"> ref="input">
<Icon type="ios-close-circle" :class="[prefixCls + '-arrow']" v-if="resetSelect" @click.native.stop="onClear"></Icon> <Icon type="ios-close-circle" :class="[prefixCls + '-arrow']" v-if="resetSelect" @click.native.stop="onClear"></Icon>
<Icon type="ios-arrow-down" :class="[prefixCls + '-arrow']" v-if="!resetSelect && !remote"></Icon> <Icon :type="arrowType" :custom="customArrowType" :size="arrowSize" :class="[prefixCls + '-arrow']" v-if="!resetSelect && !remote"></Icon>
</div> </div>
</template> </template>
<script> <script>
@ -174,6 +174,41 @@
return { return {
[`${prefixCls}-head-flex`]: this.filterable && (this.$slots.prefix || this.prefix) [`${prefixCls}-head-flex`]: this.filterable && (this.$slots.prefix || this.prefix)
}; };
},
// 3.4.0, global setting customArrow arrow
arrowType () {
let type = 'ios-arrow-down';
if (this.$IVIEW) {
if (this.$IVIEW.select.customArrow) {
type = '';
} else if (this.$IVIEW.select.arrow) {
type = this.$IVIEW.select.arrow;
}
}
return type;
},
// 3.4.0, global setting
customArrowType () {
let type = '';
if (this.$IVIEW) {
if (this.$IVIEW.select.customArrow) {
type = this.$IVIEW.select.customArrow;
}
}
return type;
},
// 3.4.0, global setting
arrowSize () {
let size = '';
if (this.$IVIEW) {
if (this.$IVIEW.select.arrowSize) {
size = this.$IVIEW.select.arrowSize;
}
}
return size;
} }
}, },
methods: { methods: {

View file

@ -168,7 +168,12 @@ const install = function(Vue, opts = {}) {
Vue.prototype.$IVIEW = { Vue.prototype.$IVIEW = {
size: opts.size || '', size: opts.size || '',
transfer: 'transfer' in opts ? opts.transfer : '' 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 : '' : '' // 下拉箭头字号
}
}; };
Vue.prototype.$Loading = LoadingBar; Vue.prototype.$Loading = LoadingBar;

View file

@ -43,7 +43,7 @@
} }
.@{select-prefix-cls}-arrow { .@{select-prefix-cls}-arrow {
transform: rotate(180deg); transform: translateY(-50%) rotate(180deg);
display: inline-block; display: inline-block;
} }
} }

View file

@ -20,7 +20,7 @@
top: 50%; top: 50%;
right: 8px; right: 8px;
line-height: 1; line-height: 1;
margin-top: -7px; transform: translateY(-50%);
font-size: @font-size-base; font-size: @font-size-base;
color: @subsidiary-color; color: @subsidiary-color;
transition: all @transition-time @ease-in-out; transition: all @transition-time @ease-in-out;