index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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 class="item">
  26. <zhcx-star star="3" color="red" :disable="false" @check="changeStar"/>
  27. <text>红星打分可点击</text>
  28. </view>
  29. </view>
  30. <view class="star" v-if="tabIndex==2">
  31. <zhcx-icon />
  32. </view>
  33. <view class="more" v-if="tabIndex==3">
  34. <text>还没写</text>
  35. <view class="accordion-content">
  36. <accordion>
  37. <!-- <view class="item" slot="item">
  38. <p>112</p>
  39. </view> -->
  40. </accordion>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="tabBar">
  45. <view class="item" v-for="item in tabBar" @click="changeTab(item.id)" :key="item.id" :class="tabIndex===item.id?'active':''">
  46. <!-- <text>icon</text> -->
  47. <text class="name">{{item.name}}</text>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import zhcxStar from '@/components/Star'
  54. import zhcxIcon from '@/components/Icon'
  55. import accordion from '@/components/Accordion'
  56. export default{
  57. name:"zhcx-componts",
  58. data:()=>{
  59. return{
  60. navTitle:"组件",
  61. tabIndex:"1",
  62. tabBar:[
  63. {
  64. id:"1",
  65. icon:"",
  66. name:"评分",
  67. path:""
  68. },
  69. {
  70. id:"2",
  71. icon:"",
  72. name:"图标",
  73. path:""
  74. },
  75. {
  76. id:"3",
  77. icon:"",
  78. name:"更多",
  79. path:""
  80. }
  81. ]
  82. }
  83. },
  84. components:{
  85. zhcxStar,zhcxIcon,accordion
  86. },
  87. methods:{
  88. changeTab(index){
  89. this.tabIndex=index;
  90. var title=this.tabBar[index-1].name;
  91. uni.setNavigationBarTitle({
  92. title
  93. })
  94. },
  95. changeStar(options){
  96. let {checked,star,index}=options;
  97. console.log({
  98. checked,star,index
  99. })
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. .content{
  106. .container{
  107. padding-bottom:100upx ;
  108. .star{
  109. .item{
  110. padding: 10upx 20upx;
  111. display: flex;
  112. justify-content: space-between;
  113. align-items: center;
  114. }
  115. }
  116. }
  117. .tabBar{
  118. width: 100%;
  119. height: 100upx;
  120. position: fixed;
  121. background-color: #fff;
  122. left: 0;
  123. bottom: 0;
  124. border-top: 1px solid #dadada;
  125. display: flex;
  126. justify-content: space-around;
  127. align-items: center;
  128. .item{
  129. width: 25%;
  130. height: 100upx;
  131. float: left;
  132. text-align: center;
  133. display: flex;
  134. justify-content: center;
  135. align-items: center;
  136. flex-direction: column;
  137. &.active{
  138. color: #3384ff;
  139. }
  140. .icon{
  141. }
  142. .name{
  143. }
  144. }
  145. }
  146. }
  147. .accordion-content{
  148. .item{
  149. width: 80%;
  150. height: 100vh;
  151. background-color: #fff;
  152. }
  153. }
  154. </style>