Ryuta Hamasaki
Web developer and bass player based in Tokyo.
Ryuta Hamasaki
@avosalmon
2018/1/23 (Tue) Laravel/Vue.js勉強会#3
Ryuta Hamasaki
Laravel / Angular / Vue
Kurashicom Inc.
Project A
Project B
Project C
Project D
Team
7
3
15
5
30
Velocity
import actions from './actions'
import getters from './getters'
import mutations from './mutations'
const state = {
sprints: [],
projects: [],
users: []
}
export default {
namespaced: true,
state,
actions,
getters,
mutations,
}
modules/sprints/_store/index.js
<script>
export default {
computed: {
...mapGetters({
sprints: '$_sprints/sprints',
users: '$_sprints/users',
projects: '$_sprints/projects',
velocity: '$_sprints/velocity',
}),
},
created() {
this.$store.registerModule('$_sprints', store)
},
mounted() {
this.$store.dispatch('$_sprints/getSprints')
this.$store.dispatch('$_sprints/getUsers')
this.$store.dispatch('$_sprints/getProjects')
},
}
</script>
modules/sprints/index.vue (container component)
Register Vuex module
Namespaced
Namespaced
{
"presets": [
"es2015",
"stage-3"
],
"plugins": [
"transform-runtime"
]
}
.babelrc
yarn add babel-preset-es2015 \
babel-preset-stage-3 \
babel-plugin-transform-runtime
By Ryuta Hamasaki