Commit 613a74e7 authored by leon's avatar leon

feat: tabs add new style options

parent 838e84ce
...@@ -26,7 +26,13 @@ ...@@ -26,7 +26,13 @@
{{ tab.name }} {{ tab.name }}
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
<template v-if="elementInfo.option.tabs.type === 'switch'">
<view @click="handleChangeSwitchValue()" class="switch-view" :style="[tabsStyle]">
{{elementData.dataList.series[currentTabs].name}}
</view>
</template>
</view> </view>
</template> </template>
...@@ -106,6 +112,11 @@ ...@@ -106,6 +112,11 @@
this.zIndex = i this.zIndex = i
} }
} }
}
if (this.elementInfo.option.tabs.type === 'switch') {
this.currentTabs = this.elementData.dataList.series.findIndex(
item => item.value === this.tabsValue
)
} }
}, },
handleShowSelect() { handleShowSelect() {
...@@ -124,7 +135,8 @@ ...@@ -124,7 +135,8 @@
handleTabsChange(index) { handleTabsChange(index) {
this.setTabsValue(index) this.setTabsValue(index)
this.tabsValueChange() this.tabsValueChange()
}, },
handleSelectChange(e) { handleSelectChange(e) {
this.selectValue = e[0].label this.selectValue = e[0].label
this.tabsValue = e[0].value this.tabsValue = e[0].value
...@@ -138,7 +150,19 @@ ...@@ -138,7 +150,19 @@
handleChangeTabValue(value) { handleChangeTabValue(value) {
this.tabsValue = value this.tabsValue = value
this.tabsValueChange() this.tabsValueChange()
}, },
handleChangeSwitchValue() {
const count = this.elementData.dataList.series.length
if(this.currentTabs === count - 1) {
this.currentTabs = 0
} else {
this.currentTabs += 1
}
this.tabsValue = this.elementData.dataList.series[this.currentTabs].value
this.tabsValueChange()
},
/** 清除值 */ /** 清除值 */
handleClearValue() { handleClearValue() {
this.tabsValue = '' this.tabsValue = ''
...@@ -152,7 +176,8 @@ ...@@ -152,7 +176,8 @@
index, index,
paramName, paramName,
data data
} = this.elementInfo.child } = this.elementInfo.child
console.log(this.tabsValue)
if (this.elementInfo.child.type === 'param') { if (this.elementInfo.child.type === 'param') {
uni.$emit('handleLinkParams', { uni.$emit('handleLinkParams', {
index, index,
...@@ -234,5 +259,14 @@ ...@@ -234,5 +259,14 @@
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
z-index: 2; z-index: 2;
}
.switch-view {
width: 100%;
font-size: var(--font-size);
color: var(--color);
background: var(--item-background-color);
display: flex;
align-items: center;
justify-content: center;
} }
</style> </style>
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
async getReportCharts() { async getReportCharts() {
clearInterval(this.timename) clearInterval(this.timename)
const that = this const that = this
let res = await that.$u.api.getReportCharts({id: '627a16644606332538b4633c'}) let res = await that.$u.api.getReportCharts({id: '63647c3932f1997dd2ed53bf'})
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
uni.$emit('handlePullDownRefresh') uni.$emit('handlePullDownRefresh')
const { Status, Result: { info, list } } = res.data const { Status, Result: { info, list } } = res.data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment