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.

74 lines
1.6 KiB

2 years ago
  1. <template>
  2. <div class="tw-flex tw-flex-col">
  3. <label class="tw-mb-[10px]" :for="input.id"><span>
  4. {{ $t(input.label)}}<span v-if="input.required" class="required">*</span></span></label>
  5. <input :id="input.id" :type="input.type" :class="[validation1 ? '' : 'tw-border-error-default']" :value="address1"
  6. v-model="inputVal" class="tw-mb-[10px]" />
  7. <input :id="`${input.id}-2`" :class="[validation2 ? '' : 'tw-border-error-default']" :type="input.type"
  8. :value="address2" v-model="inputVal2" />
  9. </div>
  10. </template>
  11. <script>
  12. export default {
  13. name: "ElementAddress",
  14. props: {
  15. input: {
  16. type: Object,
  17. },
  18. default1: {
  19. type: String,
  20. },
  21. default2: {
  22. type: String,
  23. },
  24. validation1: {
  25. type: Boolean,
  26. },
  27. validation2: {
  28. type: Boolean,
  29. },
  30. },
  31. data() {
  32. return {
  33. address1: this.default1 ? this.default1 : "",
  34. address2: this.default2 ? this.default2 : "",
  35. };
  36. },
  37. mounted() { },
  38. watch: {
  39. default1: {
  40. handler: function () {
  41. this.address1 = this.default1;
  42. },
  43. },
  44. default2: {
  45. handler: function () {
  46. this.address2 = this.default2;
  47. },
  48. },
  49. },
  50. computed: {
  51. inputVal: {
  52. get() {
  53. return this.address1;
  54. },
  55. set(val) {
  56. this.address1 = val;
  57. this.$emit("change1", val);
  58. },
  59. },
  60. inputVal2: {
  61. get() {
  62. return this.address2;
  63. },
  64. set(val) {
  65. this.address2 = val;
  66. this.$emit("change2", val);
  67. },
  68. },
  69. },
  70. };
  71. </script>
  72. <style lang="scss" scoped>
  73. </style>