SearchLayout.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <div>
  3. <div class="search-head">
  4. <div class="search-input">
  5. <a-input-search style="width: 80%; max-width: 522px;" placeholder="请输入..." size="large" enterButton="搜索" />
  6. </div>
  7. <div style="padding: 0 24px">
  8. <a-tabs :tabBarStyle="{margin: 0}" @change="callback" :activeKey="activeKey">
  9. <a-tab-pane tab="文章" key="1"></a-tab-pane>
  10. <a-tab-pane tab="项目" key="2"></a-tab-pane>
  11. <a-tab-pane tab="应用" key="3"></a-tab-pane>
  12. </a-tabs>
  13. </div>
  14. </div>
  15. <div class="search-content">
  16. <router-view />
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. export default {
  22. name: "SearchLayout",
  23. computed: {
  24. activeKey () {
  25. switch (this.$route.path) {
  26. case '/list/search/article':
  27. return '1'
  28. case '/list/search/project':
  29. return '2'
  30. case '/list/search/application':
  31. return '3'
  32. default:
  33. return '1'
  34. }
  35. }
  36. },
  37. methods: {
  38. callback (key) {
  39. switch (key) {
  40. case '1':
  41. this.$router.push('/list/search/article')
  42. break
  43. case '2':
  44. this.$router.push('/list/search/project')
  45. break
  46. case '3':
  47. this.$router.push('/list/search/application')
  48. break
  49. default:
  50. this.$router.push('/workplace')
  51. }
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang="scss" scoped>
  57. .search-head{
  58. background-color: #fff;
  59. margin: -25px -24px -24px;
  60. .search-input{
  61. text-align: center;
  62. margin-bottom: 16px;
  63. }
  64. }
  65. .search-content{
  66. margin-top: 48px;
  67. }
  68. </style>