navigationTab.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. // console.log(this.navList);
  26. },
  27. onLoad(){
  28. },
  29. methods:{
  30. navToListPage(nav){
  31. this.$api.navToListPage({type:'商品分类',value:nav.classifyName,id:nav.id});
  32. }
  33. },
  34. onShow(){
  35. }
  36. }
  37. </script>
  38. <style lang="scss">
  39. .tabbar{
  40. margin-bottom: 26rpx;
  41. }
  42. .cate-item {
  43. width: 118rpx;
  44. margin-right:28rpx;
  45. margin-bottom:28rpx;
  46. display: flex;
  47. float: left;
  48. flex-direction: column;
  49. align-items: center;
  50. font-size: $font-size-26;
  51. color: $text-color;
  52. line-height: 36rpx;
  53. &:last-child{
  54. margin-right: 0;
  55. }
  56. &:nth-child(5n){
  57. margin-right: 0;
  58. }
  59. image {
  60. width: 90rpx;
  61. height: 90rpx;
  62. margin-bottom: 8rpx;
  63. }
  64. }
  65. </style>