-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
6cc6b28
commit 03fec43
Showing
3 changed files
with
12 additions
and
17 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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import Vue from 'vue' | ||
import App from './App.vue' | ||
import store from './vuex/store' | ||
|
||
new Vue({ | ||
el: '#app', | ||
store, | ||
render: h => h(App) | ||
}) |
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 |
---|---|---|
@@ -1,25 +1,19 @@ | ||
const axios = require('axios') | ||
const mapGetters = require('vuex').mapGetters | ||
const mapActions = require('vuex').mapActions | ||
|
||
module.exports = { | ||
module.exports = { | ||
listMixin: { | ||
data() { | ||
return { | ||
categories: [] | ||
} | ||
computed: { | ||
...mapGetters({ | ||
'categories': 'getAllCategories' | ||
}) | ||
}, | ||
methods: { | ||
selectCategory (category) { | ||
category.selected = !category.selected | ||
this.$emit('selectcategory', category) | ||
} | ||
...mapActions(['fetchCategories', 'selectCategory']) | ||
}, | ||
mounted: function () { | ||
var url = 'https://raw.githubusercontent.com/jesuslerma/vuejs101-guide/master/categories.json' | ||
var that = this | ||
|
||
axios.get(url).then(function (response) { | ||
that.categories = response.data | ||
}) | ||
this.fetchCategories() | ||
} | ||
} | ||
} |