forked from vuejs/devtools-v6
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Multiple stores init * Restore formatting * Restore formatting (again) * Remove package-lock.json * Revert mutation * Commit mutation
- Loading branch information
1 parent
6f7dc1e
commit def98f4
Showing
12 changed files
with
237 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<template lang="html"> | ||
<div> | ||
Random number: {{ random }} | ||
<br> | ||
<button @click="randomize">Randomize</button> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { mapState, mapActions } from 'vuex'; | ||
export default { | ||
computed: { | ||
...mapState(['random']) | ||
}, | ||
methods: { | ||
...mapActions(['randomize']) | ||
} | ||
} | ||
</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
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: { | ||
name: 'store1', | ||
random: 0 | ||
}, | ||
mutations: { | ||
UPDATE_RANDOM(state, val) { | ||
state.random = val | ||
} | ||
}, | ||
actions: { | ||
randomize({ commit }) { | ||
const random = Math.random() | ||
commit('UPDATE_RANDOM', random) | ||
} | ||
} | ||
}) |
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
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,47 @@ | ||
<template lang="html"> | ||
<div class="container"> | ||
<span class="label">Store: </span> | ||
<select class="selector" v-model="selected"> | ||
<option :value="$idx - 1" v-for="$idx in storeCount">Store {{ $idx }}</option> | ||
</select> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { mapGetters, mapActions } from 'vuex'; | ||
export default { | ||
computed: { | ||
...mapGetters('vuex', [ | ||
'storeCount' | ||
]), | ||
selected: { | ||
get() { | ||
return this.$store.state.vuex.inspectedStoreIndex | ||
}, | ||
set(index) { | ||
this.$store.dispatch('vuex/changeStore', index) | ||
} | ||
} | ||
}, | ||
methods: { | ||
...mapActions('vuex', [ | ||
'changeStore' | ||
]) | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="stylus" scoped> | ||
.container | ||
height: 50px | ||
padding: 15px | ||
border-bottom: 1px solid #ddd | ||
.label | ||
display: inline-block | ||
color: #999 | ||
font-weight: 100 | ||
margin-right: 8px | ||
font-size: 12px | ||
</style> |
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
Oops, something went wrong.