|
|
@@ -1,8 +1,10 @@
|
|
|
<template>
|
|
|
<nav class="nav-list">
|
|
|
<div class="container">
|
|
|
- <nuxt-link to="/product/kind/home" class="item item-first">
|
|
|
- <div>器件选型</div>
|
|
|
+ <nuxt-link to="/product/kind/home" class="item item-first" tag="div">
|
|
|
+ <div>器件选型
|
|
|
+ <kind-category v-if="$route.path != '/'" @loadchild="loadProductKinds" id="kindCategory"></kind-category>
|
|
|
+ </div>
|
|
|
</nuxt-link>
|
|
|
<nuxt-link :to="'/'" class="item" exact>
|
|
|
<span>首 页</span>
|
|
|
@@ -49,37 +51,15 @@
|
|
|
</nav>
|
|
|
</template>
|
|
|
<script>
|
|
|
+ import { KindCategory } from '~components/home'
|
|
|
export default {
|
|
|
name: 'navView',
|
|
|
- data () {
|
|
|
- return {
|
|
|
- isMounted: false
|
|
|
- }
|
|
|
- },
|
|
|
- mounted () {
|
|
|
- this.$nextTick(() => {
|
|
|
- this.isMounted = true
|
|
|
- })
|
|
|
- },
|
|
|
- computed: {
|
|
|
- name () {
|
|
|
- let path = this.$route.path
|
|
|
- if (path === '/provider/factories') {
|
|
|
- return '原厂专区'
|
|
|
- } else if (path === '/provider/home') {
|
|
|
- return '代理经销'
|
|
|
- } else {
|
|
|
- return '店 铺'
|
|
|
- }
|
|
|
- },
|
|
|
- isActive () {
|
|
|
- return (this.$route.path === '/provider/factories' && this.name === '原厂专区') || (this.$route.path === '/provider/home' && this.name === '代理经销')
|
|
|
- }
|
|
|
+ components: {
|
|
|
+ KindCategory
|
|
|
},
|
|
|
methods: {
|
|
|
- open (url) {
|
|
|
- window.open(url)
|
|
|
-// this.$router.push(url)
|
|
|
+ loadProductKinds (id) {
|
|
|
+ this.$store.dispatch('loadAllProductKinds', {id})
|
|
|
},
|
|
|
goB2B () {
|
|
|
if (this.user.logged) {
|
|
|
@@ -88,6 +68,9 @@
|
|
|
this.login(`${process.env.uasUrl}`)
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ this.$store.dispatch('loadProductKinds', { id: 0 })
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
@@ -169,6 +152,15 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ #kindCategory {
|
|
|
+ display: none;
|
|
|
+ font-weight: normal;
|
|
|
+ text-align: left;
|
|
|
+ z-index: 1001;
|
|
|
+ top: 40px;
|
|
|
+ left: 0;
|
|
|
+ }
|
|
|
+
|
|
|
&.item-first {
|
|
|
width: 220px;
|
|
|
margin: 0;
|
|
|
@@ -178,6 +170,12 @@
|
|
|
text-align: center;
|
|
|
color: #fff;
|
|
|
cursor: pointer;
|
|
|
+ position: relative;
|
|
|
+ &:hover {
|
|
|
+ #kindCategory {
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|