102 行
1.8 KiB
Vue
102 行
1.8 KiB
Vue
<template>
|
|
<view>
|
|
<view class="box">
|
|
<view
|
|
v-for="(item, index) of categoryList"
|
|
:key="item.id"
|
|
:class="'nav nav-' + index"
|
|
@click="jump('/pages/goods/list', {id: item.id})"
|
|
>
|
|
{{item.name}}
|
|
</view>
|
|
</view>
|
|
|
|
<shopro-tabbar></shopro-tabbar>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import share from '@/shopro/share';
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
categoryList: [],
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.getCategoryList();
|
|
},
|
|
computed: {
|
|
|
|
},
|
|
methods: {
|
|
setNavClassName(index) {
|
|
return `nav nav-${index}`
|
|
},
|
|
// 路由跳转
|
|
jump(path, parmas) {
|
|
this.$Router.push({
|
|
path: path,
|
|
query: parmas
|
|
});
|
|
},
|
|
getCategoryList() {
|
|
uni.showLoading({
|
|
mask: true
|
|
});
|
|
|
|
this.$http('common.moneyCategoryList', {}).then(res => {
|
|
uni.hideLoading();
|
|
|
|
this.categoryList = res.data.list;
|
|
});
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.box {
|
|
display: grid;
|
|
grid-template-columns: repeat(3, 1fr);
|
|
gap: 20rpx;
|
|
margin: 20rpx;
|
|
}
|
|
|
|
.nav {
|
|
height: 180rpx;
|
|
background: linear-gradient(to right, #8a4ef5, #b289f9);
|
|
border-radius: 20rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 28rpx;
|
|
color: #fff;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.nav-0 {
|
|
background: linear-gradient(to right, #ff4544, #ff7373) !important;
|
|
}
|
|
|
|
.nav-1 {
|
|
background: linear-gradient(to right, #fc638c, #fa81a3) !important;
|
|
}
|
|
|
|
.nav-2 {
|
|
background: linear-gradient(to right, #39b1fd, #5cbdfb) !important;
|
|
}
|
|
|
|
.nav-3 {
|
|
background: linear-gradient(to right, #fe854b, #fb9e73) !important;
|
|
}
|
|
|
|
.nav-4 {
|
|
background: linear-gradient(to right, #64fea5, #96feb0) !important;
|
|
}
|
|
|
|
.nav-5 {
|
|
background: linear-gradient(to right, #55557f, #62627f) !important;
|
|
}
|
|
</style> |