Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/MemoryCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default Blits.Component('MemoryCard', {
}
})
},
focus(e) {
focus() {
this.scale = 1.08
const message = 'Card ' + (this.index + 1) + (this.disabled ? ' (disabled)' : '')
this.announcement = this.$announcer.speak(message)
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Focus.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default Blits.Component('Focus', {
left() {
this.index = Math.max(1, this.index - 1)
},
right(e) {
right() {
this.index = Math.min(3, this.index + 1)
// this.parent.$focus(e)
},
Expand Down
31 changes: 27 additions & 4 deletions src/pages/RouterHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const hookPageTemplate = {
color="#fff"
:effects="[{type: 'radialGradient', props: {colors: ['#b43fcb', '#6150cb'], pivot: [0.5, 1.1], width: 2400, height: 800}}]"
>
<Element :show="$stateInfo !== undefined">
<Text :content="$stateInfo" x="60" y="60" size="28" />
</Element>
<Element :show="$up !== undefined">
<Element src="assets/arrow.png" w="100" h="44" x="960" y="40" mount="{x: 0.5}" />
<Text :content="$up && $up.toUpperCase()" x="960" y="100" size="76" mount="{x: 0.5}" />
Expand Down Expand Up @@ -48,6 +51,7 @@ const hookPageTemplate = {
right: 'right',
down: 'down',
left: 'left',
stateInfo: '',
}
},
}
Expand Down Expand Up @@ -121,6 +125,21 @@ const Rating = Blits.Component('RouterHookRating', {
//movie flow page, with 2 directions left: back, right: next episode
const Episode = Blits.Component('RouterHookEpisode', {
...hookPageTemplate,
hooks: {
init() {
// Get router state information
const state = this.$router?.state
if (!state) return

// Display available router state information
this.stateInfo = JSON.stringify({
path: state.path || '',
params: state['params'] || {},
data: state['data'] || {},
})
},
},

state() {
return {
title: 'Episode',
Expand All @@ -134,10 +153,14 @@ const Episode = Blits.Component('RouterHookEpisode', {
this.$router.back()
},
right() {
//trigger router to navigate to the next episode, and NOT save current episode page in navigation history
this.$router.to(`/examples/router-hooks/episode/${this.page.id + 1}`, undefined, {
inHistory: false,
})
//trigger router to navigate to the next episode without adding to navigation history
this.$router.to(
`/examples/router-hooks/episode/${Number(this.$router.state['params'].id) + 1}`,
undefined,
{
inHistory: false,
}
)
},
},
})
Expand Down