navigationTab.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template name="navigation">
  2. <!-- 自定义分类导航栏 -->
  3. <view class="tabbar clearfix">
  4. <view class="cate-item" v-for="(nav,idx) in navList" :key="idx" @click="navToListPage(nav)">
  5. <image :src="nav.classifyImage"></image>
  6. <text>{{nav.classifyName}}</text>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. var self;
  12. export default{
  13. name:'navigation',
  14. props:{
  15. navList: { // 由父页面传递的数据
  16. type: Array,
  17. value: [],
  18. },
  19. },
  20. data() {
  21. return{
  22. }
  23. },
  24. created() {
  25. },
  26. onLoad(){
  27. },
  28. methods:{
  29. navToListPage(nav){
  30. this.$api.navToListPage({type:'商品分类',value:nav.classifyName,id:nav.id});
  31. }
  32. },
  33. onShow(){
  34. }
  35. }
  36. </script>
  37. <style lang="scss">
  38. .tabbar{
  39. margin-bottom: 26rpx;
  40. }
  41. .cate-item {
  42. width: 118rpx;
  43. margin-right:28rpx;
  44. margin-bottom:28rpx;
  45. display: flex;
  46. float: left;
  47. flex-direction: column;
  48. align-items: center;
  49. font-size: $font-size-26;
  50. color: $text-color;
  51. line-height: 36rpx;
  52. &:last-child{
  53. margin-right: 0;
  54. }
  55. &:nth-child(5n){
  56. margin-right: 0;
  57. }
  58. image {
  59. width: 90rpx;
  60. height: 90rpx;
  61. margin-bottom: 8rpx;
  62. }
  63. }
  64. </style>