@skyservice-developers/vue-dev-kit 1.4.0 → 1.4.1
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/dist/vue2/style.css +1 -1
- package/dist/vue2/vue-dev-kit.cjs +1 -1
- package/dist/vue2/vue-dev-kit.js +250 -241
- package/dist/vue3/style.css +1 -1
- package/dist/vue3/vue-dev-kit.cjs +1 -1
- package/dist/vue3/vue-dev-kit.js +450 -446
- package/package.json +1 -1
- package/src/vue2/components/Header.vue +24 -8
- package/src/vue3/components/Header.vue +16 -2
package/package.json
CHANGED
|
@@ -158,12 +158,7 @@ export default {
|
|
|
158
158
|
// Load componentStats from parent
|
|
159
159
|
getParentLocalStorage('componentStats').then((data) => {
|
|
160
160
|
if (data != null) {
|
|
161
|
-
|
|
162
|
-
const parsed = typeof data === 'string' ? JSON.parse(data) : data
|
|
163
|
-
if (parsed?.pages) {
|
|
164
|
-
this.localStorageItems = Object.values(parsed.pages)
|
|
165
|
-
}
|
|
166
|
-
} catch {}
|
|
161
|
+
this.loadParentComponentStats(data)
|
|
167
162
|
}
|
|
168
163
|
})
|
|
169
164
|
}
|
|
@@ -182,11 +177,32 @@ export default {
|
|
|
182
177
|
sendToParent({ type: 'setRocketMode', value: restore })
|
|
183
178
|
}
|
|
184
179
|
},
|
|
185
|
-
|
|
180
|
+
findPreviousPage() {
|
|
181
|
+
return this.sortedItems.find(item => item.name !== this.trackPageName)
|
|
182
|
+
},
|
|
183
|
+
loadParentComponentStats(data) {
|
|
184
|
+
try {
|
|
185
|
+
const parsed = typeof data === 'string' ? JSON.parse(data) : data
|
|
186
|
+
if (parsed?.pages) {
|
|
187
|
+
this.localStorageItems = Object.values(parsed.pages)
|
|
188
|
+
}
|
|
189
|
+
} catch {}
|
|
190
|
+
},
|
|
191
|
+
async handleBack() {
|
|
186
192
|
if (this.backEvent) return this.backEvent()
|
|
187
193
|
|
|
188
194
|
// Navigate to the last visited page that isn't the current one
|
|
189
|
-
|
|
195
|
+
let previousPage = this.findPreviousPage()
|
|
196
|
+
|
|
197
|
+
// If history not loaded yet, try fetching from parent
|
|
198
|
+
if (!previousPage && isInIframe()) {
|
|
199
|
+
const data = await getParentLocalStorage('componentStats')
|
|
200
|
+
if (data) {
|
|
201
|
+
this.loadParentComponentStats(data)
|
|
202
|
+
previousPage = this.findPreviousPage()
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
190
206
|
if (previousPage) {
|
|
191
207
|
this.restoreRocketMode()
|
|
192
208
|
sendToParent({ type: 'navigate', path: previousPage.path })
|
|
@@ -265,11 +265,25 @@ const restoreRocketMode = () => {
|
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
const
|
|
268
|
+
const findPreviousPage = () => {
|
|
269
|
+
return sortedItems.value.find(item => item.name !== props.trackPageName)
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
const handleBack = async () => {
|
|
269
273
|
if (props.backEvent) return props.backEvent()
|
|
270
274
|
|
|
271
275
|
// Navigate to the last visited page that isn't the current one
|
|
272
|
-
|
|
276
|
+
let previousPage = findPreviousPage()
|
|
277
|
+
|
|
278
|
+
// If history not loaded yet, try fetching from parent
|
|
279
|
+
if (!previousPage && isInIframe()) {
|
|
280
|
+
const data = await getParentLocalStorage('componentStats')
|
|
281
|
+
if (data) {
|
|
282
|
+
loadComponentStats(data)
|
|
283
|
+
previousPage = findPreviousPage()
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
273
287
|
if (previousPage) {
|
|
274
288
|
restoreRocketMode()
|
|
275
289
|
sendToParent({ type: 'navigate', path: previousPage.path })
|