You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.3 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="tw-flex tw-flex-col">
  3. <input
  4. class="user-search tw-bg-white tw-rounded-[12px] input-background tw-p-[5px] tw-border-none active:tw-border-none"
  5. :id="input.id"
  6. :type="input.type"
  7. :value="value"
  8. :placeholder="input.placeHolder"
  9. v-model="inputVal"
  10. @keyup.enter="search"
  11. />
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. name: "ElementInput",
  17. props: {
  18. input: {
  19. type: Object,
  20. },
  21. default: {
  22. type: String,
  23. },
  24. },
  25. data() {
  26. return {
  27. value: this.default ? this.default : "",
  28. };
  29. },
  30. mounted() {},
  31. watch: {
  32. default: {
  33. handler: function () {
  34. this.value = this.default;
  35. },
  36. },
  37. },
  38. computed: {
  39. inputVal: {
  40. get() {
  41. return this.value;
  42. },
  43. set(val) {
  44. this.value = val;
  45. this.$emit("change", val);
  46. },
  47. },
  48. },
  49. methods: {
  50. search() {
  51. this.$emit("search", this.value);
  52. },
  53. }
  54. };
  55. </script>
  56. <style lang="scss" scoped>
  57. .input-background {
  58. background: url('@/assets/svg/search.svg') no-repeat 95% 50%;
  59. // background-position: right;
  60. background-size: 20px;
  61. }
  62. .user-search{
  63. border: none;
  64. }
  65. </style>