@lambo-design/shared 1.0.0-beta.7 → 1.0.0-beta.9
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/utils/platform.js +10 -4
- package/utils/vxetable/index.js +15 -4
package/package.json
CHANGED
package/utils/platform.js
CHANGED
|
@@ -152,14 +152,20 @@ export const showTitle = (item, vm) => {
|
|
|
152
152
|
/**
|
|
153
153
|
* @description 本地存储和获取标签导航列表
|
|
154
154
|
*/
|
|
155
|
-
export const setTagNavListInLocalstorage = list => {
|
|
156
|
-
|
|
155
|
+
export const setTagNavListInLocalstorage = (list , key) => {
|
|
156
|
+
if (!key) {
|
|
157
|
+
key = 'LD-tagNavList';
|
|
158
|
+
}
|
|
159
|
+
localStorage[key] = JSON.stringify(list)
|
|
157
160
|
}
|
|
158
161
|
/**
|
|
159
162
|
* @returns {Array} 其中的每个元素只包含路由原信息中的name, path, meta三项
|
|
160
163
|
*/
|
|
161
|
-
export const getTagNavListFromLocalstorage = () => {
|
|
162
|
-
|
|
164
|
+
export const getTagNavListFromLocalstorage = (key) => {
|
|
165
|
+
if (!key) {
|
|
166
|
+
key = 'LD-tagNavList';
|
|
167
|
+
}
|
|
168
|
+
const list = localStorage[key]
|
|
163
169
|
return list ? JSON.parse(list) : []
|
|
164
170
|
}
|
|
165
171
|
|
package/utils/vxetable/index.js
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
export const setParentRefs = (parentVm, targetVm, refKey) => {
|
|
2
2
|
let hasFind = false;
|
|
3
3
|
if (parentVm.$refs) {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
//遍历父组件的refs里注册的组件
|
|
5
|
+
Object.entries(parentVm.$refs).forEach(([parentKey, parentValue]) => {
|
|
6
|
+
//找到targetVm组件
|
|
7
|
+
if (parentValue === targetVm) {
|
|
6
8
|
hasFind = true;
|
|
7
|
-
|
|
9
|
+
//遍历targetVm组件上注册的refKey组件
|
|
10
|
+
Object.entries(targetVm.$refs[refKey]).forEach(([key, value])=>{
|
|
11
|
+
//找到refKey组件methods里面的function
|
|
12
|
+
if(key.charAt(0) !== '$'
|
|
13
|
+
&& key.charAt(0) !== '_'
|
|
14
|
+
&& typeof value == 'function'){
|
|
15
|
+
//将function添加到targetVm组件
|
|
16
|
+
parentVm.$refs[parentKey][key] = value
|
|
17
|
+
}
|
|
18
|
+
})
|
|
8
19
|
}
|
|
9
20
|
})
|
|
10
21
|
}
|
|
11
22
|
if (!hasFind && parentVm.$parent) {
|
|
12
23
|
setParentRefs(parentVm.$parent, targetVm, refKey)
|
|
13
24
|
}
|
|
14
|
-
}
|
|
25
|
+
}
|