app-search-for.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <view class="app-view" :style="{backgroundColor: newData.background}">
  3. <view class="jump dir-left-nowrap main-center cross-center" @click="jump_route()">
  4. <view class="input main-center" :style="{backgroundColor: newData.color, borderRadius: `${newData.radius}rpx`,color: `${newData.textColor}`}">
  5. <view class="app-text-search dir-left-nowrap cross-center" :style="{color: `${newData.textColor}`}" :class="[`${newData.textPosition === 'center' ? 'main-center' : 'main-left'}`]">
  6. <view class="app-icon"></view>
  7. <text>{{newData.placeholder}}</text>
  8. </view>
  9. </view>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. import appInput from '../../basic-component/app-input/app-input.vue';
  15. export default {
  16. name: 'app-search-for',
  17. props: {
  18. value: {
  19. type: Object,
  20. default: function() {
  21. return {
  22. background: `#efeff4`,
  23. color: '#ffffff',
  24. placeholder: '搜索',
  25. radius: 28,
  26. textColor: '#999999',
  27. textPosition: `center`,
  28. }
  29. }
  30. }
  31. },
  32. components: {
  33. 'app-input': appInput,
  34. },
  35. data() {
  36. return {
  37. newData: this.value
  38. };
  39. },
  40. methods: {
  41. jump_route() {
  42. uni.navigateTo({
  43. url: '/pages/search/search'
  44. })
  45. }
  46. }
  47. }
  48. </script>
  49. <style scoped lang="scss">
  50. .jump {
  51. width: 100%;
  52. height: 100%;
  53. }
  54. .app-view {
  55. height: #{88rpx};
  56. width: #{750rpx};
  57. position: relative;
  58. border-radius: 0;
  59. border: none;
  60. }
  61. .app-text-search {
  62. z-index: 1000;
  63. width: #{704rpx};
  64. height: #{58rpx};
  65. line-height: #{58rpx};
  66. }
  67. .app-text-search text {
  68. font-size: #{26rpx};
  69. }
  70. .app-icon {
  71. margin-right: #{12rpx};
  72. margin-left: #{12rpx};
  73. width: #{25rpx};
  74. height: #{25rpx};
  75. background-size: 100% 100%;
  76. background-image: url("../../../static/image/icon/search.png");
  77. }
  78. .input {
  79. height: #{58rpx};
  80. width: #{704rpx};
  81. border: #{1rpx} solid #dcdfe6;
  82. }
  83. </style>