Commit c266c8fd by MichaelJier

取消关闭后的打赏面板回到0位置

parent 370775fe
......@@ -4,12 +4,12 @@
<div style="width:100%;height: auto;border-radius: 15px 15px 0 0;overflow: hidden;">
<div style="background: rgba(0, 0, 0, 0.9); width:100%;height: auto" @click.stop>
<div class="top-box">
<div class="tab-box">
<div :class="{ 'z-active': list[tabIndex].nameKey === 'gift' }" @click.stop="_tabSwitch(0)"
<div class="tab-box" v-show="swiper">
<div :class="{ 'z-active': list[tabIndex].nameKey === 'gift' }" @click.stop="_tabSwitch('0')"
v-if="list.some(item => item.nameKey === 'gift')">
礼物
</div>
<div :class="{ 'z-active': list[tabIndex].nameKey === 'cash' }" @click.stop="_tabSwitch(1)"
<div :class="{ 'z-active': list[tabIndex].nameKey === 'cash' }" @click.stop="_tabSwitch('1')"
v-if="list.some(item => item.nameKey === 'cash')">
现金打赏
</div>
......@@ -86,11 +86,9 @@ export default {
methods: {
close() {
this.$emit('input', false)
this.tabIndex = 0
this.swiper.slideTo('0')
},
_tabSwitch(index) {
this.swiper && this.swiper.slideTo(index + '' || this.tabIndex + '');
this.swiper.slideTo(index + '' || this.tabIndex + '');
},
_initSwiper() {
const self = this;
......@@ -108,9 +106,11 @@ export default {
watch: {
value(newVal) {
if (newVal){
this.tabIndex = 0
this.$nextTick(() => {
this._initSwiper();
this.$nextTick(() => {
this.swiper.slideTo(this.tabIndex)
})
});
}
}
......
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 sign in to comment