KindBox.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <div class="container" style="width:1190px;padding: 0;">
  3. <div style="background: #fff; z-index:10;">
  4. <div class="box-first">
  5. <div class="box-item">类目:</div>
  6. <div class="box-kind">
  7. <ul id="letter-nav">
  8. <!--| orderBy : 'namelength'-->
  9. <li class="text-num" v-for="kind in kinds">
  10. <a :title="kind.nameCn" @click="scrollTo(kind.id)">{{kind.nameCn}}</a>
  11. </li>
  12. </ul>
  13. </div>
  14. </div>
  15. <div class="box-catagory" v-for="kind in kinds" style="clear: both">
  16. <div class="box">
  17. <div class="box-title" :id="kind.id">
  18. <div class="box-smtitle">
  19. <div>
  20. <nuxt-link :to="`/product/kind/${kind.id}`"><span :title="kind.nameCn">{{kind.nameCn}}</span></nuxt-link>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="box-content">
  25. <div class="box-subcatagory">
  26. <div class="childkind" v-for="child in kind.children">
  27. <dl class="dl-horizontal">
  28. <dt class="dt-title">
  29. <ul>
  30. <li>
  31. <nuxt-link :to="`/product/kind/${child.id}`" :title="child.nameCn"><span>{{child.nameCn}}</span></nuxt-link>
  32. </li>
  33. </ul>
  34. </dt>
  35. <dd>
  36. <ul class="list-unstyled list-inline">
  37. <li v-if="leaf.nameCn.length<=15" v-for="leaf in child.children">
  38. <nuxt-link :to="`/product/kind/${leaf.id}`" :title="leaf.nameCn"><span>{{leaf.nameCn}}</span></nuxt-link>
  39. </li>
  40. <li style="width: 35%" v-if="leaf.nameCn.length>15" v-for="leaf in child.children">
  41. <nuxt-link :to="`/product/kind/${leaf.id}`" :title="leaf.nameCn">{{leaf.nameCn}}</nuxt-link>
  42. </li>
  43. </ul>
  44. </dd>
  45. </dl>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. </template>
  54. <script>
  55. import { scrollTo } from '~utils/scroll'
  56. export default {
  57. name: 'kind-box',
  58. computed: {
  59. kinds () {
  60. return this.$store.state.product.kind.kinds.data
  61. }
  62. },
  63. methods: {
  64. scrollTo: function (el) {
  65. scrollTo(document.getElementById(el), 10)
  66. }
  67. }
  68. }
  69. </script>
  70. <style>
  71. .box {
  72. margin-bottom: 20px;
  73. }
  74. .box .box-title {
  75. border-bottom: 4px solid #6493FF;
  76. }
  77. .box .box-smtitle span {
  78. background-color: #6493FF;
  79. line-height: 28px;
  80. padding: 8px 30px;
  81. font-size: 14px;
  82. font-weight: 100;
  83. }
  84. .box .box-title a {
  85. color: #FFF;
  86. font-weight: bolder;
  87. }
  88. .box .box-title h4 {
  89. margin-top: 5px;
  90. margin-bottom: 5px;
  91. line-height: 30px;
  92. }
  93. .box .box-content {
  94. position: relative;
  95. width: 100%;
  96. margin: 0 auto;
  97. }
  98. .box .box-content .box-subcatagory {
  99. background-color: #ffffff;
  100. border-radius: 5px;
  101. }
  102. .box .box-content .box-subcatagory .childkind {
  103. border-bottom: 1px solid #ccc;
  104. border-bottom-style: dashed;
  105. }
  106. .box .box-content .box-subcatagory dl, .box .box-content .box-subcatagory ul
  107. {
  108. padding-bottom: 5px;
  109. margin-bottom: 0px;
  110. }
  111. .box .box-content .box-subcatagory dl dt {
  112. width: 160px;
  113. margin-left: 20px;
  114. }
  115. .box .box-content .box-subcatagory dl dt span{
  116. width: 125px;
  117. display: inline-block;
  118. overflow: hidden;
  119. text-overflow: ellipsis;
  120. white-space: nowrap;
  121. }
  122. .box .box-content .box-subcatagory dl dt a {
  123. color: #000;
  124. font-size: 14px;
  125. font-weight: 500;
  126. }
  127. .box .box-content .box-subcatagory dl dt a:hover {
  128. color: #6493FF;
  129. }
  130. .box .box-content .box-subcatagory dl dd {
  131. margin-left: 180px;
  132. margin-bottom: 10px;
  133. margin-top: 20px;
  134. }
  135. .box .box-content .box-subcatagory .list-inline {
  136. margin-left: 0;
  137. }
  138. .box .box-content .box-subcatagory .list-inline>li {
  139. width: 20%;
  140. margin-bottom: 10px;
  141. vertical-align: top;
  142. font-size: 14px;
  143. }
  144. .box .box-content .box-subcatagory .list-inline>li a {
  145. color: #000;
  146. font-size: 14px;
  147. font-weight: 500;
  148. }
  149. .box .box-content .box-subcatagory .list-inline>li a:hover {
  150. color: #6493FF;
  151. }
  152. .box-first {
  153. margin-top: 10px;
  154. }
  155. .box-first .box-item {
  156. float: left;
  157. width: 55px;
  158. margin-left: 30px;
  159. font-size: 14px;
  160. padding-top: 10px;
  161. }
  162. .box-first .box-kind {
  163. float: right;
  164. width: 1050px;
  165. margin-left: 50px;
  166. font-size: 14px;
  167. }
  168. #letter-nav ul, #letter-nav li {
  169. list-style-type: none;
  170. }
  171. #letter-nav li {
  172. float: left;
  173. width: 130px;
  174. margin-right: 12px;
  175. margin-bottom: 15px;
  176. padding: 5px;
  177. overflow: hidden;
  178. text-overflow: ellipsis;
  179. white-space: nowrap;
  180. }
  181. #letter-nav li a {
  182. color: #000;
  183. padding: 5px;
  184. border-radius: 5px;
  185. }
  186. #letter-nav li a:hover {
  187. color: #337ab7;
  188. cursor: pointer;
  189. text-decoration: none;
  190. }
  191. .dl-horizontal .dt-title{
  192. text-align:left;
  193. margin-left: -20px;
  194. }
  195. .dt-title li{
  196. float: left;
  197. list-style: none;
  198. max-width: 150px;
  199. color: #fff;
  200. overflow: hidden;
  201. text-overflow: ellipsis;
  202. white-space: nowrap;
  203. }
  204. .box-first{
  205. border: #e8e8e8 1px solid;
  206. width: 100%;
  207. display: inline-block;
  208. margin-top: 16px;
  209. margin-bottom: 16px;
  210. padding-top: 10px;
  211. }
  212. </style>