mirror of
https://github.com/yangzongzhuan/RuoYi-App.git
synced 2025-09-28 07:02:40 +00:00
升级uni-ui到最新版本1.5.7
This commit is contained in:
@@ -1,21 +1,16 @@
|
||||
<template>
|
||||
<view :class="[styleType === 'text'?'segmented-control--text' : 'segmented-control--button' ]"
|
||||
:style="{ borderColor: styleType === 'text' ? '' : activeColor }" class="segmented-control">
|
||||
<view v-for="(item, index) in values" :class="[ styleType === 'text' ? '': 'segmented-control__item--button',
|
||||
index === currentIndex&&styleType === 'button' ? 'segmented-control__item--button--active': '',
|
||||
index === 0&&styleType === 'button' ? 'segmented-control__item--button--first': '',
|
||||
index === values.length - 1&&styleType === 'button' ? 'segmented-control__item--button--last': '' ]" :key="index"
|
||||
:style="{ backgroundColor: index === currentIndex && styleType === 'button' ? activeColor : '',borderColor: index === currentIndex&&(styleType === 'text'||styleType === 'button')?activeColor:'#d9d9d9' }"
|
||||
<view v-for="(item, index) in values" :class="[styleType === 'text' ? '' : 'segmented-control__item--button',
|
||||
index === 0 && styleType === 'button' ? 'segmented-control__item--button--first' : '',
|
||||
index === values.length - 1 && styleType === 'button' ? 'segmented-control__item--button--last':'']" :key="index"
|
||||
:style="{backgroundColor: index === currentIndex && styleType === 'button' ? activeColor : styleType === 'button' ?inActiveColor:'transparent', borderColor: index === currentIndex && styleType === 'text' || styleType === 'button' ? activeColor : inActiveColor}"
|
||||
class="segmented-control__item" @click="_onClick(index)">
|
||||
<view>
|
||||
<text :style="{color:
|
||||
index === currentIndex
|
||||
? styleType === 'text'
|
||||
? activeColor
|
||||
: '#fff'
|
||||
: styleType === 'text'
|
||||
? '#000'
|
||||
: activeColor}" class="segmented-control__text" :class="styleType === 'text' && index === currentIndex ? 'segmented-control__item--text': ''">{{ item }}</text>
|
||||
<text
|
||||
:style="{color:index === currentIndex? styleType === 'text'? activeColor: '#fff': styleType === 'text'? '#000': activeColor}"
|
||||
class="segmented-control__text"
|
||||
:class="styleType === 'text' && index === currentIndex ? 'segmented-control__item--text': ''">{{ item }}</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
@@ -32,6 +27,7 @@
|
||||
* @value button 按钮类型
|
||||
* @value text 文字类型
|
||||
* @property {String} activeColor 选中的标签背景色与边框颜色
|
||||
* @property {String} inActiveColor 未选中的标签背景色与边框颜色
|
||||
* @property {Array} values 选项数组
|
||||
* @event {Function} clickItem 组件触发点击事件时触发,e={currentIndex}
|
||||
*/
|
||||
@@ -54,6 +50,10 @@
|
||||
type: String,
|
||||
default: '#2979FF'
|
||||
},
|
||||
inActiveColor: {
|
||||
type: String,
|
||||
default: 'transparent'
|
||||
},
|
||||
styleType: {
|
||||
type: String,
|
||||
default: 'button'
|
||||
@@ -71,6 +71,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
created() {
|
||||
this.currentIndex = this.current
|
||||
},
|
||||
@@ -87,7 +88,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" >
|
||||
<style lang="scss" scoped>
|
||||
.segmented-control {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
@@ -142,4 +143,4 @@
|
||||
line-height: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user