Commit 7e70ee05 authored by 夏敏伟's avatar 夏敏伟

优化代码

parent ffe4516f
......@@ -11,7 +11,7 @@
<div class="left-content">
<div class="leftModule bk-homeapge-animation" v-for="(item, index) in modules.leftModule">
<div :class="['module-info', isSelected == index ? ('selectedModule-left' + index) : '', 'left-div-' + index]"
@click="choiceModuleLeft(index)">
@click="choiceModule(index)">
<div class="info-description">
<div v-text="item.name"></div>
<div v-text="item.description"></div>
......@@ -35,7 +35,7 @@
<div class="right-content">
<div class="rightModule bk-homeapge-animation" v-for="(item, index) in modules.rightModule">
<div :class="['module-info', isSelected == (index + 3) ? ('selectedModule-right' + index) : '', 'right-div-' + index]"
@click="choiceModuleRight(index)">
@click="choiceModule(index + 3)">
<div class="info-description">
<div v-text="item.name"></div>
<div v-text="item.description"></div>
......@@ -56,7 +56,7 @@ export default {
name: 'homepage',
data() {
return {
isSelected: 0,
isSelected: -1,
modules: {
leftModule: [
{ id: 1, name: '目标对象库', description: 'Target Object Library' },
......@@ -83,7 +83,7 @@ export default {
}
},
methods: {
choiceModuleLeft(index) {
choiceModule(index) {
let arr = this.query_selector('.leader-line');
if (arr.length > 0) {
arr.forEach(element => {
......@@ -94,17 +94,6 @@ export default {
this.$store.commit("activeIndex", index);
this.$router.push("/");
},
choiceModuleRight(index) {
let arr = this.query_selector('.leader-line');
if (arr.length > 0) {
arr.forEach(element => {
element.remove();
});
}
this.isSelected = index + 3;
this.$store.commit("activeIndex", index + 3);
this.$router.push("/");
},
query_selector(selector) {
return Array.from(document.querySelectorAll(selector));
}
......
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