Explorar el Código

修改导航

master
王饶冀 hace 2 años
padre
commit
cb5fefa956
Se han modificado 1 ficheros con 21 adiciones y 11 borrados
  1. 21
    11
      digital-park-web/digital-park/src/components/Header.vue

+ 21
- 11
digital-park-web/digital-park/src/components/Header.vue Ver fichero

<!-- 导航 --> <!-- 导航 -->
<template> <template>
<div class="header">
<div class="header" :class="{'isIndex':isIndex}">
<div class="wrap"> <div class="wrap">
<section class="wrap_left"> <section class="wrap_left">
<!-- <img src="@assets/image/index/logo.png" alt="logo" /> <!-- <img src="@assets/image/index/logo.png" alt="logo" />
小昆山数据可视化平台 -->
小昆山数据可视化平台-->
<!-- <img src="@assets/image/index/logo-n.png" alt="logo" /> --> <!-- <img src="@assets/image/index/logo-n.png" alt="logo" /> -->
{{ areaName }} {{ areaName }}
</section> </section>
currentAccount: "currentAccount", currentAccount: "currentAccount",
}), }),
}, },
watch: {
$route: {
// $route可以用引号,也可以不用引号 监听的对象
handler(to, from) {
this.isIndex = to.name == "Index" ? true : false;
},
immediate: true, // 第一次初始化渲染就可以监听到
},
},
data() { data() {
//这里存放数据 //这里存放数据
return { return {
isIndex: false,
nav: [ nav: [
{ {
name: "园区首页", name: "园区首页",
], ],
}; };
}, },
//监控data中的数据变化
watch: {},
//方法集合 //方法集合
methods: { methods: {
clickRouter(path) { clickRouter(path) {
}, },
// 前往我的企业 // 前往我的企业
goMyCompany() { goMyCompany() {
let path = '/my-business';
console.log(this.currentAccount,'this.currentAccount')
if(!this.currentAccount){
path = '/login'
let path = "/my-business";
console.log(this.currentAccount, "this.currentAccount");
if (!this.currentAccount) {
path = "/login";
} }
this.$router.push(path); this.$router.push(path);
}, },
//生命周期 - 创建完成(可以访问当前this实例) //生命周期 - 创建完成(可以访问当前this实例)
created() {}, created() {},
//生命周期 - 挂载完成(可以访问DOM元素) //生命周期 - 挂载完成(可以访问DOM元素)
mounted() {
},
mounted() {},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
background: transparent; background: transparent;
@include flex(row, center, center, wrap); @include flex(row, center, center, wrap);
@include border-box; @include border-box;
background: rgba($color: #000000, $alpha: .3)
&.isIndex{
background: rgba($color: #000000, $alpha: 0.3);
}
} }
.wrap { .wrap {
@include size($wrapWidth, 100%); @include size($wrapWidth, 100%);

Cargando…
Cancelar
Guardar