-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Caio Biodere
committed
Feb 19, 2018
1 parent
7d66d5c
commit 50c0d53
Showing
7 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<template> | ||
<f7-page> | ||
<f7-navbar title="About F7" back-link="Back" sliding></f7-navbar> | ||
<f7-block-title>{{user.name ? "You are already logged" : "Please login"}}</f7-block-title> | ||
<f7-list> | ||
<f7-list-group v-if="user.name"> | ||
<f7-list-item>ID: {{user.id}}</f7-list-item> | ||
<f7-list-item>Username: {{user.name}}</f7-list-item> | ||
</f7-list-group> | ||
</f7-list> | ||
<f7-list> | ||
<f7-list-button color="blue" v-on:click="loginAction">Login Button</f7-list-button> | ||
</f7-list> | ||
</f7-page> | ||
</template> | ||
<script> | ||
import { mapState, mapActions } from 'vuex' | ||
export default { | ||
computed: { | ||
...mapState({ | ||
user: state => state.user | ||
}) | ||
}, | ||
methods: { | ||
loginAction: function() { | ||
const self = this; | ||
// Set new user into storage | ||
self.userLogged({name: "User", id: "#1"}); | ||
}, | ||
...mapActions(['userLogged']) | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Vue from 'vue' | ||
import Vuex from 'vuex' | ||
|
||
Vue.use(Vuex); | ||
|
||
export default new Vuex.Store({ | ||
state: { | ||
user: {} | ||
}, | ||
|
||
actions: { | ||
userLogged ({commit}, user) { | ||
commit('USER_LOGGED', user) | ||
} | ||
}, | ||
|
||
mutations: { | ||
USER_LOGGED (state, user) { | ||
state.user = user | ||
} | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters