Skip to content

Commit

Permalink
Merge pull request #23 from XiaofengZeng/fix
Browse files Browse the repository at this point in the history
fix(module): 处理Issue#18的问题
  • Loading branch information
XiaofengZeng authored Mar 22, 2022
2 parents 61776f6 + 1bd2cbf commit 3b75345
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions src/components/Main/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,30 @@
</template>

<script>
import { mapState } from 'vuex';
export default {
name: 'Main',
computed: {
...mapState(['scenes']),
},
beforeUpdate() {
// 在使用URL跳转主界面时,进行判断并将值设置进Vuex中
this.scenes.forEach((s) => {
if (this.$router.currentRoute.path.indexOf(s.path) > -1) {
this.$store.commit('setScene', s.key);
}
});
},
};
</script>

<style lang="less" scoped>
.kn-main {
display: flex;
flex: 1 1 auto;
text-align: center;
align-items: center;
justify-content: center;
}
.kn-main {
display: flex;
flex: 1 1 auto;
text-align: center;
align-items: center;
justify-content: center;
}
</style>

0 comments on commit 3b75345

Please sign in to comment.