haiwei-skins-classics 1.0.2 → 1.0.4
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 +3 -3
- package/src/components/header/index.vue +31 -0
- package/src/components/main/index.vue +1 -1
- package/src/index.vue +1 -1
- package/src/main.js +8 -0
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "haiwei-skins-classics",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "HaiWei前端框架经典皮肤组件",
|
|
5
5
|
"author": "Eric",
|
|
6
6
|
"license": "ISC",
|
|
7
|
-
"main": "
|
|
7
|
+
"main": "src/index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"serve": "vue-cli-service serve",
|
|
10
10
|
"build": "vue-cli-service build",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"pub": "cd ./script && npm_publish.bat"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"haiwei-ui": "^1.0.
|
|
19
|
+
"haiwei-ui": "^1.0.3"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@vue/cli-plugin-babel": "^4.0.0",
|
|
@@ -39,8 +39,39 @@ export default {
|
|
|
39
39
|
...mapState('app/account', ['menus', 'routeMenus']),
|
|
40
40
|
...mapState('app/page', ['current'])
|
|
41
41
|
},
|
|
42
|
+
created() {
|
|
43
|
+
// 初始化时设置菜单
|
|
44
|
+
this.initMenus()
|
|
45
|
+
},
|
|
42
46
|
methods: {
|
|
43
47
|
...mapMutations('app/skins/classics', ['setMenus']),
|
|
48
|
+
initMenus() {
|
|
49
|
+
// 如果有当前路由,尝试设置对应的菜单
|
|
50
|
+
if (this.current.name && this.routeMenus) {
|
|
51
|
+
let routeMenu = this.routeMenus.get(this.current.name)
|
|
52
|
+
if (routeMenu) {
|
|
53
|
+
for (var i = 0; i < this.menus.length; i++) {
|
|
54
|
+
if (this.menus[i].id === routeMenu.menu.rootId) {
|
|
55
|
+
this.curr = this.menus[i].id
|
|
56
|
+
this.setMenus(this.menus[i].children)
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// 如果没有匹配的路由,设置第一个菜单的子菜单(如果有)
|
|
63
|
+
if (this.menus && this.menus.length > 0) {
|
|
64
|
+
const firstMenu = this.menus[0]
|
|
65
|
+
this.curr = firstMenu.id
|
|
66
|
+
if (firstMenu.children && firstMenu.children.length > 0) {
|
|
67
|
+
this.setMenus(firstMenu.children)
|
|
68
|
+
} else {
|
|
69
|
+
this.setMenus([])
|
|
70
|
+
}
|
|
71
|
+
} else {
|
|
72
|
+
this.setMenus([])
|
|
73
|
+
}
|
|
74
|
+
},
|
|
44
75
|
onNavClick(menu) {
|
|
45
76
|
this.curr = menu.id
|
|
46
77
|
// 节点类型
|
package/src/index.vue
CHANGED