@tongfun/tf-widget 0.1.9 → 0.1.13

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.
@@ -22,7 +22,8 @@
22
22
  ```
23
23
 
24
24
  2. 三级缓存数组,通过事件@setThirdCache传递
25
- 3. 例子:
25
+
26
+ 例子:
26
27
 
27
28
  ```javascript
28
29
  <template>
@@ -67,3 +68,48 @@ export default {
67
68
  },
68
69
  ```
69
70
 
71
+ 5. 为了防止路由标签混乱,需要在子应用的跟路由将当前子应用的路由base属性,添加到meta属性中
72
+
73
+ base配置统一采用:
74
+
75
+ ```
76
+ const base = process.env['NODE_ENV'] === 'development' ? process.env['VUE_APP_BASIC']:`/app${process.env['VUE_APP_BASIC']}/`
77
+ ```
78
+
79
+
80
+
81
+ ​ **配置文件:**
82
+
83
+ ​ **例: VUE_APP_BASIC = '/OperateAnalysis'**
84
+
85
+ ​ **VUE_APP_MODULE_NAME = '经营分析'**
86
+
87
+ ```javascript
88
+
89
+ // 示例
90
+ // 路由生成 base:
91
+ router = new VueRouter({
92
+ base: process.env['NODE_ENV'] === 'development' ? process.env['VUE_APP_BASIC'] : `/app${process.env['VUE_APP_BASIC']}/`,
93
+ mode: 'history',
94
+ routes: initMenu(prop.menuInfo)
95
+ })
96
+ // 跟路由配置base
97
+ const base = process.env['NODE_ENV'] === 'development' ? process.env['VUE_APP_BASIC'] : `/app${process.env['VUE_APP_BASIC']}/`
98
+ const routes = [
99
+ {
100
+ path: '/',
101
+ component: Layout,
102
+ meta: {
103
+ title: process.env['VUE_APP_MODULE_NAME'],
104
+ base
105
+ },
106
+ children: [
107
+ ...childrenRoutes
108
+ ]
109
+ }
110
+ ]
111
+
112
+
113
+
114
+ ```
115
+
@@ -2,7 +2,7 @@
2
2
  <div class="tf-labelbar">
3
3
  <div class="close-menu">
4
4
  <div
5
- :class="coloseMenu ? 'open-menu-icon': 'close-menu-icon'"
5
+ :class="closeMenu ? 'open-menu-icon': 'close-menu-icon'"
6
6
  src=""
7
7
  alt=""
8
8
  title="隐藏列表"
@@ -78,9 +78,15 @@ export default {
78
78
  TfRotateBox,
79
79
  TfRightMenu
80
80
  },
81
+ props: {
82
+ routeBase: {
83
+ default: null,
84
+ type: String
85
+ }
86
+ },
81
87
  data () {
82
88
  return {
83
- coloseMenu: false,
89
+ closeMenu: false,
84
90
  activePath: '/',
85
91
  tagList: [],
86
92
  rightMenuLeft: 0,
@@ -91,7 +97,8 @@ export default {
91
97
  watch: {
92
98
  $route: {
93
99
  handler: function (newValue) {
94
- if (newValue) {
100
+ console.log(this.routeBase)
101
+ if (newValue && newValue.matched[0]?.meta.base === this.routeBase) {
95
102
  const { meta, path, name, params, query } = newValue
96
103
  if (!path) return
97
104
  const obj = {
@@ -129,8 +136,8 @@ export default {
129
136
  },
130
137
  methods: {
131
138
  changeMenuState () {
132
- this.coloseMenu = !this.coloseMenu
133
- this.$emit('changeMenuState', this.coloseMenu)
139
+ this.closeMenu = !this.closeMenu
140
+ this.$emit('changeMenuState', this.closeMenu)
134
141
  },
135
142
  /**
136
143
  * @description tag右键点击事件
@@ -6,6 +6,7 @@
6
6
  />
7
7
  <div class="tf-layout-subject">
8
8
  <TfLaberBar
9
+ :route-base="routeBase"
9
10
  @setCache="setCache"
10
11
  @changeMenuState="changeMenuState"
11
12
  @deleteCache="deleteCache"
@@ -34,6 +35,10 @@ export default {
34
35
  default: function () {
35
36
  return []
36
37
  }
38
+ },
39
+ routeBase: {
40
+ default: null,
41
+ type: String
37
42
  }
38
43
  },
39
44
  data () {
@@ -44,8 +49,16 @@ export default {
44
49
  thirdCacheArr: []
45
50
  }
46
51
  },
52
+ watch: {
53
+ routeBase: {
54
+ handler: function (newValue) {
55
+ console.log(newValue)
56
+ },
57
+ immediate: true
58
+ }
59
+ },
47
60
  methods: {
48
- changeMenuState(state) {
61
+ changeMenuState (state) {
49
62
  this.menuState = state
50
63
  },
51
64
  setCache (value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tongfun/tf-widget",
3
- "version": "0.1.9",
3
+ "version": "0.1.13",
4
4
  "description": "tf-widget",
5
5
  "main": "lib/tf-widget.umd.js",
6
6
  "private": false,