parent
a0f40dfcae
commit
8eefae4247
|
@ -639,6 +639,22 @@ export default defineComponent({
|
||||||
return this.photoswipe;
|
return this.photoswipe;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Set the route hash to the given photo */
|
||||||
|
setFragment(photo: IPhoto | null) {
|
||||||
|
// Add or update fragment
|
||||||
|
if (photo) {
|
||||||
|
return fragment.push({
|
||||||
|
type: fragment.types.viewer,
|
||||||
|
args: [String(photo.dayid), photo.key!],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove fragment if closed
|
||||||
|
if (!this.isOpen) {
|
||||||
|
return fragment.pop(fragment.types.viewer);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/** Open using start photo and rows list */
|
/** Open using start photo and rows list */
|
||||||
async openDynamic(anchorPhoto: IPhoto, rows: IRow[]) {
|
async openDynamic(anchorPhoto: IPhoto, rows: IRow[]) {
|
||||||
const detail = anchorPhoto.d?.detail;
|
const detail = anchorPhoto.d?.detail;
|
||||||
|
@ -869,22 +885,6 @@ export default defineComponent({
|
||||||
return elem;
|
return elem;
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Set the route hash to the given photo */
|
|
||||||
setFragment(photo: IPhoto | null) {
|
|
||||||
// Add or update fragment
|
|
||||||
if (photo) {
|
|
||||||
return fragment.push({
|
|
||||||
type: fragment.types.viewer,
|
|
||||||
args: [String(photo.dayid), photo.key!],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove fragment if closed
|
|
||||||
if (!this.isOpen) {
|
|
||||||
return fragment.pop(fragment.types.viewer);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the metadata (image info) for a photo asynchronously
|
* Load the metadata (image info) for a photo asynchronously
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -53,6 +53,9 @@ const cache = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
/**
|
||||||
|
* List of all fragment types.
|
||||||
|
*/
|
||||||
types: FragmentType,
|
types: FragmentType,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,6 +151,11 @@ export default {
|
||||||
return this.get(FragmentType.viewer);
|
return this.get(FragmentType.viewer);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trigger when route changes. Only called by App.vue as a router hook.
|
||||||
|
* @param to Switching to this route
|
||||||
|
* @param from Switching from this route
|
||||||
|
*/
|
||||||
changeTrigger(to: Route, from: Route) {
|
changeTrigger(to: Route, from: Route) {
|
||||||
const toF = decodeFragment(to.hash);
|
const toF = decodeFragment(to.hash);
|
||||||
const fromF = decodeFragment(from.hash);
|
const fromF = decodeFragment(from.hash);
|
||||||
|
|
Loading…
Reference in New Issue