我覺得我應該是有哪個盲點沒發現
task是想透過資訊傳遞讓:class綁定
希望大家能幫我找到盲點 謝謝
以下是顯示的畫面
<template>
<div class="item1">
<ul class="novice_left_nav tab_click fl">
<div class="novice_top"></div>
<li :class="{'hasSelece': SkillType == 'Baccarat'}">
<a href="javascript:void(0);" @click="changeContent('webTutorialSkills');SkillType='Baccarat'"><i class="novice_icon_1"></i>百家乐</a>
</li>
<li :class="{'hasSelece': SkillType == 'Roulette'}">
<a href="javascript:void(0);" @click="changeContent('roulette');SkillType='Roulette'"><i class="novice_icon_3"></i>轮盘</a>
</li>
<li :class="{'hasSelece': SkillType == 'Sicbo'}">
<a href="javascript:void(0);" @click="changeContent('sicbo');SkillType='Sicbo'"><i class="novice_icon_4"></i>骰宝</a>
</li>
<li :class="{'hasSelece': SkillType == 'Other'}">
<a href="javascript:void(0);" @click="changeContent('other');SkillType='Other'"><i class="novice_icon_5"></i>其他</a>
</li>
</ul>
<router-view></router-view>
<div class="clearfix"></div>
</div>
</template>
<script>
import EventBus from 'scripts/common/EventBus';
export default {
data() {
return {
SkillType: 'Baccarat',
BettingTipsType: {
Baccarat: 'Baccarat',
Roulette: 'Roulette',
Sicbo: 'Sicbo',
Other: 'Other',
},
};
},
created() {
EventBus.$on('changeClass', type => {
this.SkillType = type;
console.log(type);
console.log(this.SkillType);
});
},
methods: {
changeContent(type) {
this.$router.push({ name: type });
}
},
// beforeDestroy() {
// EventBus.$off('changeClass');
// }
};
</script>
console.log的結果有顯示出對應的值
以下是EventBus.$emit
ReturnBack: function () {
console.log(this.$route.params.type);
this.$router.push({ name: this.$route.params.type, params: { DetailBettingTipsType: this.$route.params.BettingTipsType } });
EventBus.$emit('changeClass', this.DetailBettingTipsType);
}
照理說this.SkillType修改後class應該就會綁定特定的dom
但卻沒有 class一直是綁在Baccarat百家樂這個dom
想請問是哪邊出了問題
謝謝