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.

59 lines
1.1 KiB

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