Skip to content

Instantly share code, notes, and snippets.

@xseignard
Created February 14, 2019 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xseignard/bef5a39e39642547fddbdca605a0400d to your computer and use it in GitHub Desktop.
Save xseignard/bef5a39e39642547fddbdca605a0400d to your computer and use it in GitHub Desktop.
<template lang="html">
<v-container v-if="clock" class="screen" fluid fill-height>
{{room.timer}}
</v-container>
<v-container v-else class="alert" fluid fill-height>
Some non-reactive stuff.
</v-container>
</template>
<script>
import { mapState } from 'vuex';
export default {
data: () => ({
clock: true,
}),
computed: {
...mapState({
room(state) {
return state.rooms[this.$route.params.roomId * 2 - 1];
},
}),
},
updated() {
if (this.room.open && this.clock) {
this.clock = false;
// do some non reactive computations
else {
this.clock = true;
// do some computation with the updated state
}
},
};
</script>
@xseignard
Copy link
Author

xseignard commented Feb 14, 2019

Ca, ça marche par contre ?!

<template lang="html">
	<v-container v-if="room.open" class="screen" fluid fill-height>
		{{room.timer}}
	</v-container>
	<v-container v-else class="alert" fluid fill-height>
		Some non-reactive stuff.
	</v-container>
</template>

<script>
import { mapState } from 'vuex';
export default {
	computed: {
		...mapState({
			room(state) {
				return state.rooms[this.$route.params.roomId * 2 - 1];
			},
		}),
	},
	updated() {
		if (this.room.open) {
			// do some non reactive computations
		} else {
			// do some computation with the updated state
		}
	},
};
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment