mirror of
https://gitee.com/TSpecific/tuniao-ui.git
synced 2026-06-07 03:53:57 +08:00
修复分段器动态赋值不生效的bug
This commit is contained in:
@@ -1,31 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<view
|
<view class="tn-subsection-class tn-subsection" :class="[subsectionBackgroundColorClass]"
|
||||||
class="tn-subsection-class tn-subsection"
|
:style="[subsectionStyle]">
|
||||||
:class="[subsectionBackgroundColorClass]"
|
|
||||||
:style="[subsectionStyle]"
|
|
||||||
>
|
|
||||||
<!-- 滑块 -->
|
<!-- 滑块 -->
|
||||||
<block v-for="(item, index) in listInfo" :key="index">
|
<block v-for="(item, index) in listInfo" :key="index">
|
||||||
<view
|
<view class="tn-subsection__item tn-text-ellipsis" :class="[
|
||||||
class="tn-subsection__item tn-text-ellipsis"
|
|
||||||
:class="[
|
|
||||||
'section-item-' + index,
|
'section-item-' + index,
|
||||||
noBorderRight(index)
|
noBorderRight(index)
|
||||||
]"
|
]" :style="[itemStyle(index)]" @tap="click(index)">
|
||||||
:style="[itemStyle(index)]"
|
|
||||||
@tap="click(index)"
|
|
||||||
>
|
|
||||||
<view class="tn-subsection__item--text tn-text-ellipsis" :style="[textStyle(index)]">
|
<view class="tn-subsection__item--text tn-text-ellipsis" :style="[textStyle(index)]">
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
<!-- 背景 -->
|
<!-- 背景 -->
|
||||||
<view
|
<view class="tn-subsection__bg" :class="[itemBarClass]" :style="[itemBarStyle]"></view>
|
||||||
class="tn-subsection__bg"
|
|
||||||
:class="[itemBarClass]"
|
|
||||||
:style="[itemBarStyle]"
|
|
||||||
></view>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -49,7 +37,7 @@
|
|||||||
// tab的数据
|
// tab的数据
|
||||||
list: {
|
list: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default() {
|
default () {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -123,6 +111,24 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
list: {
|
||||||
|
handler(val) {
|
||||||
|
this.listInfo = val.map((item, index) => {
|
||||||
|
if (typeof item !== 'object') {
|
||||||
|
let obj = {
|
||||||
|
width: 0,
|
||||||
|
name: item
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
} else {
|
||||||
|
item.width = 0
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
immediate: true,
|
||||||
|
deep: true
|
||||||
|
},
|
||||||
current: {
|
current: {
|
||||||
handler(val) {
|
handler(val) {
|
||||||
this.currentIndex = val
|
this.currentIndex = val
|
||||||
@@ -337,7 +343,6 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
.tn-subsection {
|
.tn-subsection {
|
||||||
/* #ifndef APP-PLUS */
|
/* #ifndef APP-PLUS */
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -406,5 +411,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user