ResultTitle.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <div class="result-title text-muted">
  3. 搜索"<span class="text-inverse" >{{keyword}}</span>"<span v-if="status != 1">暂无结果</span>
  4. <span v-if="status != 3">,为您找到
  5. <span class="text-num" v-text="good_list.total"></span> 个<span v-if="status == 2">相关</span>产品</span>:
  6. </div>
  7. </template>
  8. <script>
  9. export default{
  10. props: ['keyword', 'page'],
  11. data () {
  12. return {
  13. status: 1
  14. }
  15. },
  16. computed: {
  17. good_lists () {
  18. return this.$store.state.searchData.searchList.lists
  19. },
  20. good_list () {
  21. if (this.page === 1) {
  22. if (this.good_lists.data.components && this.good_lists.data.components.length > 0) {
  23. if (this.keyword.toUpperCase() === this.good_lists.data.components[0].code.toUpperCase()) {
  24. this.status = 1
  25. } else {
  26. this.status = 2
  27. }
  28. } else {
  29. this.status = 3
  30. }
  31. }
  32. return this.good_lists.data
  33. }
  34. }
  35. }
  36. </script>
  37. <style scoped>
  38. #searchResult .result-title {
  39. margin-top: 5px;
  40. padding: 10px 5px;
  41. height: 30px;
  42. line-height: 30px;
  43. font-size: 14px;
  44. }
  45. .text-inverse {
  46. color: #f40!important;
  47. }
  48. .text-num {
  49. font-style: normal;
  50. font-family: verdana;
  51. }
  52. </style>