Skip to content

Commit

Permalink
整理我的日记列表数据
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaobinwu committed Apr 10, 2017
1 parent a9235dc commit 25d51fa
Show file tree
Hide file tree
Showing 2 changed files with 595 additions and 7 deletions.
20 changes: 14 additions & 6 deletions assets/modules/diary/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ div.wuji-container.center-block
span
span 全部
span ({{categoryTotal}})
li
span
span 未分类
span (0)
li(v-for="category in categoryList", @click="activeCategory = category.categoryId")
span(:style="{backgroundColor: '#' + category.colorHex, borderColor: '#' + category.colorHex}")
span(:style="{backgroundColor: '#' + (category.colorHex ? category.colorHex : 'transparent'), borderColor: '#' + (category.colorHex ? category.colorHex : '808080')}")
span {{category.name}}
span ({{category.diaryCount}})
div.wuji-add
Expand All @@ -31,12 +27,14 @@ export default {
data () {
return {
categoryList: [],
diaryList: [],
activeCategory: 0
}
},
created(){
window.a = this;
this.getCategoryList();
this.getMyDiarys();
},
methods:{
getCategoryList(){
Expand All @@ -47,7 +45,17 @@ export default {
}).catch(error => {
Message({message: error, type: 'error', showClose: true});
});
}
},
getMyDiarys(){
let _self = this, params;
//params => 参数
Api.getMyDiarys(params).then(result => {
_self.diaryList = result;
console.log(_self.diaryList);
}).catch(error => {
Message({message: error, type: 'error', showClose: true});
});
},
},
computed:{
categoryTotal(){
Expand Down
Loading

0 comments on commit 25d51fa

Please sign in to comment.