组件按需加载

This commit is contained in:
A1300399510
2023-07-13 17:34:25 +08:00
parent 348057a649
commit a626223e64
10 changed files with 97 additions and 110 deletions

View File

@@ -51,7 +51,6 @@
<script setup>
import { ref, reactive, onMounted, getCurrentInstance } from 'vue'
import { useRouter } from 'vue-router'
import { ElLoading } from 'element-plus'
const { proxy } = getCurrentInstance()
const router = useRouter()
@@ -84,11 +83,11 @@ onMounted(() => {
})
async function init() {
loading = ElLoading.service({
lock: true,
text: 'Loading',
background: 'rgba(0, 0, 0, 0.7)',
})
// loading = ElLoading.service({
// lock: true,
// text: 'Loading',
// background: 'rgba(0, 0, 0, 0.7)',
// })
// if (identityList.value > 0) return
proxy.$post("/tenement/pc/api/publish/checkidentity").then(res => {
@@ -99,7 +98,7 @@ async function init() {
isintermediary.value = data.isintermediary
if (data['ispopup'] == 0) overallJump()
}).finally(() => {
loading.close()
// loading.close()
})
}
@@ -124,7 +123,7 @@ let choiceItem = (key) => {
let overallJump = () => {
choicePopState.value = false
console.log("11",identityKey.value);
console.log("11", identityKey.value);
router.push(`/edit?intermediary=${identityKey.value}`)
}

View File

@@ -1,7 +1,8 @@
<template>
<header class="container-header flexflex">
<nav class="header-nav flexacenter">
<div class="header-nav-item" :class="{ pitch: index == 3 }" v-for="(item, index) in navList" :key="index">{{ item }}</div>
<a class="header-nav-item" :class="{ pitch: item['key'] == 'fang' }" v-for="(item, index) in nav" :key="index"
:href="item.url" target="_blank">{{ item.name }}</a>
<img class="header-nav-item header-user-img" :src="user.avatar">
</nav>
<div class="logo-box flexacenter">
@@ -10,13 +11,8 @@
</div>
<div class="header-bj-box"></div>
<nav class="nav-box flexflex" v-if="!isNoTabList">
<div class="nav-list wid1200 flexflex">
<!-- <<<<<<< HEAD
<div class="nav-item flexcenter" :class="{ pitch: item['name'] == '我的' }" v-for="item in tabList"
:key="item">{{ item.name }}</div>
======= -->
<div class="tab-btn dis-f al-item jus-x" :class="{ 'tab-btn-click': i === 0 }" v-for="(item, i) in tabList"
:key="i">
<el-badge :value="12">
@@ -26,24 +22,27 @@
</el-badge>
</div>
<!-- >>>>>>> origin/main -->
</div>
</nav>
</header>
</template>
<script setup>
import { useStore } from 'vuex'
import { toRefs } from 'vue';
// 是否不需要导航栏
const props = defineProps({
isNoTabList: {
type: Boolean,
default: false
},
user: Object,
// user: Object,
});
const navList = ["寄托首页", "论坛", "Offer榜", "港校租房", "院校库", "兑换店", "搜索", "招生官", "中外合办院校"]
const store = useStore();
const { user, nav } = toRefs(store.state);
// const navList = ["寄托首页", "论坛", "Offer榜", "港校租房", "院校库", "兑换店", "搜索", "招生官", "中外合办院校"]
const tabList = [{
name: '首页',