index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <view class="content">
  3. <view class="container">
  4. <view class="star" v-if="tabIndex==1">
  5. <view class="item">
  6. <zhcx-star key="star" />
  7. <text>默认</text>
  8. </view>
  9. <view class="item">
  10. <zhcx-star star="4.2" key="star-level" />
  11. <text>自定义等级</text>
  12. </view>
  13. <view class="item">
  14. <zhcx-star key="star-color" star="5" color="orange" />
  15. <text>自定义颜色</text>
  16. </view>
  17. <view class="item">
  18. <zhcx-star key="star-icon" star="2.5" icon="zhcx-icon-aixin" />
  19. <text>自定义图标</text>
  20. </view>
  21. <view class="item">
  22. <zhcx-star star="4.4" color="#3384ff" :disable="false" @check="changeStar"/>
  23. <text>可点击</text>
  24. </view>
  25. </view>
  26. <view class="star" v-if="tabIndex==2">
  27. <zhcx-icon />
  28. </view>
  29. <view class="more" v-if="tabIndex==3">
  30. <text>还没写</text>
  31. </view>
  32. </view>
  33. <view class="tabBar">
  34. <view class="item" v-for="item in tabBar" @click="changeTab(item.id)" :key="item.id" :class="tabIndex===item.id?'active':''">
  35. <!-- <text>icon</text> -->
  36. <text class="name">{{item.name}}</text>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import zhcxStar from '@/components/Star'
  43. import zhcxIcon from '@/components/Icon'
  44. export default{
  45. name:"zhcx-componts",
  46. data:()=>{
  47. return{
  48. navTitle:"组件",
  49. tabIndex:"1",
  50. tabBar:[
  51. {
  52. id:"1",
  53. icon:"",
  54. name:"评分",
  55. path:""
  56. },
  57. {
  58. id:"2",
  59. icon:"",
  60. name:"图标",
  61. path:""
  62. },
  63. {
  64. id:"3",
  65. icon:"",
  66. name:"更多",
  67. path:""
  68. }
  69. ]
  70. }
  71. },
  72. components:{
  73. zhcxStar,zhcxIcon
  74. },
  75. methods:{
  76. changeTab(index){
  77. this.tabIndex=index;
  78. var title=this.tabBar[index-1].name;
  79. uni.setNavigationBarTitle({
  80. title
  81. })
  82. },
  83. changeStar(options){
  84. let {checked,star,index}=options;
  85. console.log({
  86. checked,star,index
  87. })
  88. }
  89. }
  90. }
  91. </script>
  92. <style lang="scss" scoped>
  93. .content{
  94. .container{
  95. .star{
  96. .item{
  97. padding: 10upx 20upx;
  98. display: flex;
  99. justify-content: space-between;
  100. align-items: center;
  101. }
  102. }
  103. }
  104. .tabBar{
  105. width: 100%;
  106. height: 100upx;
  107. position: fixed;
  108. background-color: #fff;
  109. left: 0;
  110. bottom: 0;
  111. border-top: 1px solid #dadada;
  112. display: flex;
  113. justify-content: space-around;
  114. align-items: center;
  115. .item{
  116. width: 25%;
  117. height: 100upx;
  118. float: left;
  119. text-align: center;
  120. display: flex;
  121. justify-content: center;
  122. align-items: center;
  123. flex-direction: column;
  124. &.active{
  125. color: #3384ff;
  126. }
  127. .icon{
  128. }
  129. .name{
  130. }
  131. }
  132. }
  133. }
  134. </style>