vue2-client 1.8.28 → 1.8.30

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/CHANGELOG.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Change Log
2
2
  > 所有关于本项目的变化都在该文档里。
3
3
 
4
- **1.8.27 -2023-1-10 @张振宇**
4
+ **1.8.30 -2023-1-10 @张振宇**
5
5
  - 微前端兼容
6
6
 
7
7
  **1.8.26 -2023-1-10 @杨亚文**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.8.28",
3
+ "version": "1.8.30",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -35,8 +35,9 @@ const progressStart = (to, from, next) => {
35
35
  * @param options
36
36
  */
37
37
  const loginGuard = (to, from, next, options) => {
38
- console.log('loginGuard', to, from, next, options)
39
-
38
+ if (window.__MICRO_APP_ENVIRONMENT__) {
39
+ window.microApp.dispatch({ type: '子应用发送给主应用的数据', to: to.path })
40
+ }
40
41
  const urlParams = new URLSearchParams(window.location.search)
41
42
  const token = urlParams.get('token')
42
43
  const V4_LOGIN_DATA_KEY = localStorage.getItem('v4LoginData')
@@ -89,7 +90,7 @@ const loginGuard = (to, from, next, options) => {
89
90
  r: v4LoginData.r
90
91
  }
91
92
  Vue.$store.commit('account/setLogin', login)
92
- // loadRoutes(funcToRouter(v4LoginData.functions))
93
+ loadRoutes(funcToRouter(v4LoginData.functions))
93
94
  next()
94
95
  } else {
95
96
  const { store, message } = options
@@ -346,6 +346,10 @@ function parsefunc (func) {
346
346
  icon: row.icon,
347
347
  name: row.name
348
348
  }
349
+ if (row.link.includes('$')) {
350
+ route.router = row.link.split('$')[1]
351
+ route.params = row.link.split('$')[0]
352
+ }
349
353
  if (row.children && row.children.length > 0) {
350
354
  route.children = parsefunc(row.children)
351
355
  }
@@ -358,10 +362,7 @@ function parsefunc (func) {
358
362
  * 资源服务路由排序
359
363
  */
360
364
  function positionRouter (r) {
361
- let router = []
362
- for (const row of r) {
363
- router[row.position] = row
364
- }
365
+ let router = r.sort((a, b) => a.position - b.position)
365
366
  router = arrRemoveEmpty(router)
366
367
  return router
367
368
  }