goods-nav.nvue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <view>
  3. <text class="example-info"> uni-goods-nav 组件主要用于电商类应用底部导航,可自定义加入购物车,购买等操作</text>
  4. <uni-section title="基础用法" type="line"></uni-section>
  5. <view class="example-body">
  6. <uni-goods-nav @click="onClick" />
  7. </view>
  8. <uni-section title="自定义用法" type="line"></uni-section>
  9. <view class="example-body">
  10. <uni-goods-nav :fill="true" :options="options" :button-group="buttonGroup" @click="onClick" @buttonClick="buttonClick" />
  11. </view>
  12. <view class="goods-carts">
  13. <uni-goods-nav :options="options" :fill="true" :button-group="buttonGroup" @click="onClick" @buttonClick="buttonClick" />
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. components: {},
  20. data() {
  21. return {
  22. options: [{
  23. icon: 'headphones',
  24. text: '客服'
  25. }, {
  26. icon: 'shop',
  27. text: '店铺',
  28. info: 2,
  29. infoBackgroundColor: '#007aff',
  30. infoColor: "#f5f5f5"
  31. }, {
  32. icon: 'cart',
  33. text: '购物车',
  34. info: 2
  35. }],
  36. buttonGroup: [{
  37. text: '加入购物车',
  38. backgroundColor: '#ffa200',
  39. color: '#fff'
  40. },
  41. {
  42. text: '立即购买',
  43. backgroundColor: '#ff0000',
  44. color: '#fff'
  45. }
  46. ]
  47. }
  48. },
  49. onLoad() {},
  50. methods: {
  51. onClick(e) {
  52. uni.showToast({
  53. title: `点击${e.content.text}`,
  54. icon: 'none'
  55. })
  56. },
  57. buttonClick(e) {
  58. console.log(e)
  59. this.options[2].info++
  60. }
  61. }
  62. }
  63. </script>
  64. <style>
  65. @charset "UTF-8";
  66. /* 头条小程序组件内不能引入字体 */
  67. /* #ifdef MP-TOUTIAO */
  68. @font-face {
  69. font-family: uniicons;
  70. font-weight: normal;
  71. font-style: normal;
  72. src: url("~@/static/uni.ttf") format("truetype");
  73. }
  74. /* #endif */
  75. /* #ifndef APP-NVUE */
  76. page {
  77. display: flex;
  78. flex-direction: column;
  79. box-sizing: border-box;
  80. background-color: #efeff4;
  81. min-height: 100%;
  82. height: auto;
  83. }
  84. view {
  85. font-size: 14px;
  86. line-height: inherit;
  87. }
  88. .example {
  89. padding: 0 15px 15px;
  90. }
  91. .example-info {
  92. padding: 15px;
  93. color: #3b4144;
  94. background: #ffffff;
  95. }
  96. .example-body {
  97. /* #ifndef APP-NVUE */
  98. display: flex;
  99. /* #endif */
  100. flex-direction: row;
  101. flex-wrap: wrap;
  102. justify-content: center;
  103. padding: 0;
  104. font-size: 14px;
  105. background-color: #ffffff;
  106. }
  107. /* #endif */
  108. .example {
  109. padding: 0 15px;
  110. }
  111. .example-info {
  112. /* #ifndef APP-NVUE */
  113. display: block;
  114. /* #endif */
  115. padding: 15px;
  116. color: #3b4144;
  117. background-color: #ffffff;
  118. font-size: 14px;
  119. line-height: 20px;
  120. }
  121. .example-info-text {
  122. font-size: 14px;
  123. line-height: 20px;
  124. color: #3b4144;
  125. }
  126. .example-body {
  127. flex-direction: column;
  128. padding: 15px;
  129. background-color: #ffffff;
  130. }
  131. .word-btn-white {
  132. font-size: 18px;
  133. color: #FFFFFF;
  134. }
  135. .word-btn {
  136. /* #ifndef APP-NVUE */
  137. display: flex;
  138. /* #endif */
  139. flex-direction: row;
  140. align-items: center;
  141. justify-content: center;
  142. border-radius: 6px;
  143. height: 48px;
  144. margin: 15px;
  145. background-color: #007AFF;
  146. }
  147. .word-btn--hover {
  148. background-color: #4ca2ff;
  149. }
  150. .example-body {
  151. padding: 0;
  152. /* #ifndef APP-NVUE */
  153. display: block;
  154. /* #endif */
  155. }
  156. .goods-carts {
  157. /* #ifndef APP-NVUE */
  158. display: flex;
  159. /* #endif */
  160. flex-direction: column;
  161. position: fixed;
  162. left: 0;
  163. right: 0;
  164. bottom: 0;
  165. }
  166. </style>