@jx3box/jx3box-vue3-ui 0.8.9 → 0.8.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/header/Nav.vue +14 -12
package/package.json
CHANGED
package/src/header/Nav.vue
CHANGED
|
@@ -126,21 +126,22 @@
|
|
|
126
126
|
</template>
|
|
127
127
|
|
|
128
128
|
<script>
|
|
129
|
+
import { cloneDeep } from "lodash";
|
|
129
130
|
import default_nav from "../../assets/data/nav.json";
|
|
130
131
|
import { getMenu } from "../../service/header";
|
|
131
132
|
import { trimSlash } from "../../utils";
|
|
132
133
|
|
|
133
134
|
const activeNav = {
|
|
134
|
-
index: [
|
|
135
|
-
macro: [
|
|
136
|
-
tool: [
|
|
137
|
-
bps: [
|
|
138
|
-
fb: [
|
|
139
|
-
cj: [
|
|
140
|
-
pvx: [
|
|
141
|
-
bbs: [
|
|
142
|
-
pvp: [
|
|
143
|
-
}
|
|
135
|
+
index: ["index"],
|
|
136
|
+
macro: ["macro", "pz"],
|
|
137
|
+
tool: ["app", "jx3dat", "dbm"],
|
|
138
|
+
bps: ["bps", "jcl", "battle"],
|
|
139
|
+
fb: ["fb", "baizhan", "team", "jdt", "rank"],
|
|
140
|
+
cj: ["cj", "item", "knowledge", "quest"],
|
|
141
|
+
pvx: ["face", "adventure", "pvg"],
|
|
142
|
+
bbs: ["bbs", "topic", "event"],
|
|
143
|
+
pvp: ["pvp"],
|
|
144
|
+
};
|
|
144
145
|
export default {
|
|
145
146
|
name: "HeaderNav",
|
|
146
147
|
props: [],
|
|
@@ -153,6 +154,7 @@ export default {
|
|
|
153
154
|
},
|
|
154
155
|
computed: {
|
|
155
156
|
finalNav: function ({ nav }) {
|
|
157
|
+
nav = cloneDeep(nav);
|
|
156
158
|
// 父节点
|
|
157
159
|
const finalNav = nav.filter((d) => !d.parentKey && d.status);
|
|
158
160
|
// 子节点
|
|
@@ -183,8 +185,8 @@ export default {
|
|
|
183
185
|
methods: {
|
|
184
186
|
isFocus: function (type) {
|
|
185
187
|
// return location.pathname.includes(type);
|
|
186
|
-
let active =
|
|
187
|
-
const pathname = location.pathname?.split(
|
|
188
|
+
let active = "";
|
|
189
|
+
const pathname = location.pathname?.split("/")?.filter(Boolean)?.[0] || "";
|
|
188
190
|
for (const key in activeNav) {
|
|
189
191
|
if (activeNav[key].includes(pathname)) {
|
|
190
192
|
active = key;
|