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.

57 lines
1.1 KiB

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