goods-top-tabs.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view class="top-tabs">
  3. <tui-tabs
  4. :tabs="tabs"
  5. itemWidth="33.3333%"
  6. :currentTab="currentTab"
  7. @change="change"
  8. :isFixed="true"
  9. selectedColor="#ff457b"
  10. sliderBgColor="#ff457b"
  11. ></tui-tabs>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. name: 'goods-top-tabs',
  17. props: {
  18. current: {
  19. type: Number,
  20. default: 0
  21. }
  22. },
  23. data() {
  24. return {
  25. currentTab: 0,
  26. tabs: [
  27. {
  28. name: '商品'
  29. },
  30. {
  31. name: '详情'
  32. },
  33. {
  34. name: '服务项目'
  35. }
  36. ]
  37. }
  38. },
  39. watch: {
  40. current: {
  41. handler: function(nVal) {
  42. this.currentTab = nVal
  43. },
  44. immediate: true
  45. }
  46. },
  47. methods: {
  48. change(e) {
  49. this.currentTab = e.index
  50. this.$emit('change', this.currentTab)
  51. }
  52. }
  53. }
  54. </script>
  55. <style lang="scss" scoped></style>