Skip to content

Commit

Permalink
Fix bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
Geek-James committed Mar 16, 2020
1 parent 5303868 commit 6559784
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 16 additions & 17 deletions src/views/category/Category.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @Motto: 求知若渴,虚心若愚
* @Github: https://github.com/Geek-James/ddBuy
* @掘金: https://juejin.im/user/5c4ebc72e51d4511dc7306ce
* @LastEditTime: 2020-03-13 16:44:37
* @LastEditTime: 2020-03-16 16:54:41
* @Description: 分类
* @FilePath: /ddBuy-dev/src/views/category/Category.vue
-->
Expand All @@ -12,18 +12,17 @@
<!--头部-->
<Header></Header>
<!--内容-->
<div class="listWrapper" v-if="!isShowLoading">
<div class="listWrapper"
v-if="!isShowLoading">
<!--左边-->
<div class="leftWrapper">
<ul class="wrapper">
<li
class="categoryItem"
v-for="(cate, index) in categoriesData"
:class="{ selected: currentIndex === index }"
@click="clickLeftLi(index)"
:key="cate.id"
ref="menuList"
>
<li class="categoryItem"
v-for="(cate, index) in categoriesData"
:class="{ selected: currentIndex === index }"
@click="clickLeftLi(index)"
:key="cate.id"
ref="menuList">
<span class="textWrapper">{{ cate.name }}</span>
</li>
</ul>
Expand Down Expand Up @@ -56,10 +55,10 @@ import Loading from '../../components/loading/LoadingGif'
// 5.引入加载动画
import LoadingGif from '../../components/loading/Loading'
// 6.引入骨架屏
import Skeleton from './skeleton'
import Skeleton from './Skeleton'
export default {
name: 'Category',
data() {
data () {
return {
// 是否显示加载图标
isShowLoading: true,
Expand All @@ -72,8 +71,8 @@ export default {
isShowLoadingGif: false
}
},
created() {},
mounted() {
created () { },
mounted () {
// 初始化数据
this._initData()
},
Expand All @@ -84,7 +83,7 @@ export default {
LoadingGif,
Skeleton
},
activated() {
activated () {
// 页面缓存了数据,所以会走这个方法
this.$nextTick(() => {
if (this.$route.params.currentIndex > -1) {
Expand All @@ -94,7 +93,7 @@ export default {
},
methods: {
// 1. 初始化操作(数据和界面)
async _initData() {
async _initData () {
// 1.1 获取左边的数据
let leftRes = await getCategoryData()
if (leftRes.success) {
Expand Down Expand Up @@ -124,7 +123,7 @@ export default {
})
},
// 2. 处理左边的点击
async clickLeftLi(index) {
async clickLeftLi (index) {
this.isShowLoadingGif = true
// 2.1 改变索引
this.currentIndex = index
Expand Down

0 comments on commit 6559784

Please sign in to comment.