月球大数据地理空间分析展示平台-【前端】-月球2期前端
surprise
2023-11-03 8259d48200ce9477ecbe16e8426161493211b593
src/components/topBtn.vue
@@ -4,16 +4,44 @@
      <div
        class="first_Menu"
        :title="item.name"
        v-for="(item,i) in menuOptions"
        v-for="(item, i) in menuOptions"
        :key="i"
        @click="setMenuClick(item)"
      >
        <div class="First_img">
          <img
            class="imgIcon"
            :src="require('../assets/img/topBtn/'+item.imgUrl)"
          >
            :src="require('../assets/img/topBtn/' + item.imgUrl)"
          />
        </div>
        <div
        <div class="menu_second">
          <div
            class="upTop"
            v-show="item.children &&item.children.length>0 "
          >
            <div class="upimg"></div>
          </div>
          <div class="second_Box">
            <div
              class="second_Menu"
              :title="res.name"
              v-for="(res, j) in item.children"
              :key="j"
              @click="setMenuClick(res)"
              :class="{ second_Menu_click: checkFlag == res.id }"
            >
              <img
                class="imgIcon"
                style="margin-bottom: 5px"
                :src="require('../assets/img/topBtn/' + res.imgUrl)"
              />
              <div class="name_box">
                {{ res.name }}
              </div>
            </div>
          </div>
        </div>
        <!-- <div
          class="menu_second"
          v-if="item.children && item.children.length > 0"
          v-show="menuFlag == item.id"
@@ -25,24 +53,22 @@
            <div
              class="second_Menu"
              :title="res.name"
              v-for="(res,j) in item.children"
              v-for="(res, j) in item.children"
              :key="j"
              @click="setMenuClick(res)"
              :class="{'second_Menu_click':checkFlag == res.id}"
              :class="{ second_Menu_click: checkFlag == res.id }"
            >
              <img
                class="imgIcon"
                style="margin-bottom: 5px;"
                :src="require('../assets/img/topBtn/'+res.imgUrl)"
              >
              <div>
                style="margin-bottom: 5px"
                :src="require('../assets/img/topBtn/' + res.imgUrl)"
              />
              <div class="name_box">
                {{ res.name }}
              </div>
            </div>
          </div>
        </div>
        </div> -->
      </div>
    </div>
  </div>
@@ -59,9 +85,11 @@
} from "vue";
import menuData from "@/assets/js/Map/menuData.js";
import menuTool from "@/assets/js/Map/menuTool.js";
import store from "@/store";
const menuFlag = ref(null);
const menuOptions = ref([]);
const checkFlag = ref(null);
let checkArr = ref([]);
const setMenuClick = (res) => {
  if (res.children) {
    if (menuFlag.value && menuFlag.value == res.id) {
@@ -73,13 +101,19 @@
  } else {
    if (res.level == 1) {
      checkFlag.value = null;
      // console.log(res);
      if (res.name == "清除") {
        menuTool.clearALL(checkArr);
      }
    } else if (res.level == 2) {
      checkFlag.value = res.id;
      checkArr.value.push(res.id);
    }
    menuFlag.value = null;
    menuTool.menuTools(res);
    menuTool.topTools(res);
  }
};
onMounted(() => {
  menuOptions.value = menuData.topMenu;
});
@@ -87,32 +121,36 @@
<style lang="less" scoped>
.top_btn {
  position: absolute;
  top: 23px;
  right: 0px;
  // position: absolute;
  // top: 23px;
  // right: 0px;
  display: flex;
  cursor: pointer;
  z-index: 30;
  .menu_Box {
    margin-right: 104px;
    margin-right: 50px;
    display: flex;
    .imgIcon {
      width: 30px;
      height: 30px;
    }
    .first_Menu {
      min-width: 50px;
      width: 50px;
      height: 50px;
      margin-right: 7px;
      background: url("../assets/img/topBtn/图标bj.png") no-repeat;
      background-size: 100% 100%;
      opacity: 0.8;
      .First_img {
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        opacity: 1;
      }
    }
    .upTop {
      width: 100%;
      height: 10px;
@@ -125,13 +163,15 @@
      }
    }
    .menu_second {
      margin-top: 0px;
      display: none;
    }
    .second_Box {
      min-width: 50px;
      background: #07080e;
      box-shadow: inset 0px 0px 15px 0px rgb(38, 47, 71, 0.68);
      .second_Menu {
        min-width: 50px;
        background: #07080e;
        box-shadow: inset 0px 0px 8px 0px rgb(38, 47, 71, 0.68);
        margin-top: 1px;
@@ -140,9 +180,12 @@
        padding: 10px 10px;
        font-weight: 300;
        color: #d1e0ff;
        line-height: 7px;
        // display: flex;
        text-align: center;
        border: 1px solid none;
        .name_box {
          line-height: 7px;
          white-space: nowrap;
        }
      }
      .second_Menu_click {
@@ -153,6 +196,12 @@
          0px 7px 8px 0px rgba(38, 47, 71, 0.68);
      }
    }
    .first_Menu:hover .menu_second {
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-top: 0px;
    }
  }
}
</style>
</style>