top.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <div id="top">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <el-col :span="24" class="one" v-if="topType == '1'">
  6. <van-search v-model="searchName" placeholder="请输入信息标题" @search="search" />
  7. </el-col>
  8. <el-col :span="24" class="two" v-else-if="topType == '2'">
  9. <van-nav-bar :title="this.$route.meta.title" left-text="返回" left-arrow @click-left="upBack" />
  10. </el-col>
  11. <el-col :span="24" class="thr" v-else-if="topType == '3'">
  12. <el-col :span="4" class="back" @click.native="upBack"> <van-icon name="arrow-left" />返回 </el-col>
  13. <el-col :span="20" class="search">
  14. <van-search v-model="searchName" placeholder="请输入赠与人名称" @search="search" />
  15. </el-col>
  16. </el-col>
  17. </el-col>
  18. </el-row>
  19. </div>
  20. </template>
  21. <script>
  22. import { mapState, createNamespacedHelpers } from 'vuex';
  23. export default {
  24. name: 'top',
  25. props: {
  26. topType: { type: String, default: () => '1' },
  27. },
  28. components: {},
  29. data: function() {
  30. return {
  31. searchName: '',
  32. };
  33. },
  34. created() {},
  35. methods: {
  36. // 查询
  37. search() {
  38. this.$emit('search', { searchName: this.searchName });
  39. },
  40. // 返回
  41. upBack() {
  42. this.$emit('upBack');
  43. },
  44. },
  45. computed: {
  46. ...mapState(['user']),
  47. },
  48. metaInfo() {
  49. return { title: this.$route.meta.title };
  50. },
  51. watch: {
  52. test: {
  53. deep: true,
  54. immediate: true,
  55. handler(val) {},
  56. },
  57. },
  58. };
  59. </script>
  60. <style lang="less" scoped>
  61. .main {
  62. .one {
  63. /deep/.van-search {
  64. padding: 3px 5px;
  65. }
  66. }
  67. .two {
  68. /deep/.van-nav-bar__content {
  69. height: 40px;
  70. }
  71. }
  72. .thr {
  73. .back {
  74. color: #409eff;
  75. padding: 8px 0;
  76. text-align: center;
  77. .van-icon {
  78. top: 3px;
  79. }
  80. }
  81. .search {
  82. /deep/.van-search {
  83. padding: 2px 5px 2px 0px;
  84. }
  85. }
  86. }
  87. }
  88. </style>