Anchor.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <SmartLink
  3. :to="`${/^\/(?!\/).*$/.test(to) ? localePath(to) : to}`"
  4. :exact="exact"
  5. :blank="blank"
  6. class="inline-flex items-center justify-center focus:outline-none"
  7. :class="[
  8. color
  9. ? `text-${color}-500 hover:text-${color}-600 focus-visible:text-${color}-600`
  10. : 'hover:text-secondaryDark focus-visible:text-secondaryDark',
  11. { 'opacity-75 cursor-not-allowed': disabled },
  12. { 'flex-row-reverse': reverse },
  13. ]"
  14. :disabled="disabled"
  15. >
  16. <i
  17. v-if="icon"
  18. :class="label ? (reverse ? 'ml-2' : 'mr-2') : ''"
  19. class="material-icons"
  20. >
  21. {{ icon }}
  22. </i>
  23. <SmartIcon
  24. v-if="svg"
  25. :name="svg"
  26. :class="label ? (reverse ? 'ml-2' : 'mr-2') : ''"
  27. class="svg-icons"
  28. />
  29. {{ label }}
  30. </SmartLink>
  31. </template>
  32. <script>
  33. import { defineComponent } from "@nuxtjs/composition-api"
  34. export default defineComponent({
  35. props: {
  36. to: {
  37. type: String,
  38. default: "",
  39. },
  40. exact: {
  41. type: Boolean,
  42. default: true,
  43. },
  44. blank: {
  45. type: Boolean,
  46. default: false,
  47. },
  48. label: {
  49. type: String,
  50. default: "",
  51. },
  52. icon: {
  53. type: String,
  54. default: "",
  55. },
  56. svg: {
  57. type: String,
  58. default: "",
  59. },
  60. color: {
  61. type: String,
  62. default: "",
  63. },
  64. disabled: {
  65. type: Boolean,
  66. default: false,
  67. },
  68. reverse: {
  69. type: Boolean,
  70. default: false,
  71. },
  72. },
  73. })
  74. </script>