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.

60 lines
1.2 KiB

2 years ago
2 years ago
  1. <template>
  2. <div class="tw-flex tw-flex-col">
  3. <select :class="['tw-pr-[40px]', validation ? '' : 'tw-border-error-default']" v-model="value" @change="inputVal">
  4. <option :value="0">{{ $t("Select option") }}</option>
  5. <option v-for="(name, index) in yearList" :key="index">
  6. {{ name }}
  7. </option>
  8. </select>
  9. </div>
  10. </template>
  11. <script>
  12. export default {
  13. name: "ElementSelect",
  14. props: {
  15. select: {
  16. type: Object,
  17. },
  18. yearList: {
  19. type: Array,
  20. },
  21. default: {
  22. type: String,
  23. },
  24. validation: {
  25. type: Boolean,
  26. },
  27. },
  28. data() {
  29. return {
  30. value: this.default ?? null,
  31. };
  32. },
  33. mounted() { },
  34. watch: {
  35. default: {
  36. handler: function () {
  37. this.value = this.default;
  38. },
  39. },
  40. },
  41. methods: {
  42. inputVal() {
  43. this.$emit("change", this.value);
  44. },
  45. },
  46. };
  47. </script>
  48. <style lang="scss" scoped>
  49. select {
  50. -moz-appearance: none;
  51. /* Firefox */
  52. -webkit-appearance: none;
  53. /* Safari and Chrome */
  54. appearance: none;
  55. background-image: url("~/assets/svg/down-arrow.svg");
  56. background-size: 9px 6px;
  57. background-position: right 20px center;
  58. background-repeat: no-repeat;
  59. }
  60. </style>