公众号前端
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

48 строки
914 B

  1. <template>
  2. <svg :class="getClassName" :width="width" :height="height" aria-hidden="true">
  3. <use :xlink:href="getName"></use>
  4. </svg>
  5. </template>
  6. <script>
  7. export default {
  8. name: 'icon-svg',
  9. props: {
  10. name: {
  11. type: String,
  12. required: true
  13. },
  14. className: {
  15. type: String
  16. },
  17. width: {
  18. type: String
  19. },
  20. height: {
  21. type: String
  22. }
  23. },
  24. computed: {
  25. getName() {
  26. return `#icon-${this.name}`
  27. },
  28. getClassName() {
  29. return [
  30. 'icon-svg',
  31. `icon-svg__${this.name}`,
  32. this.className && /\S/.test(this.className) ? `${this.className}` : ''
  33. ]
  34. }
  35. }
  36. }
  37. </script>
  38. <style>
  39. .icon-svg {
  40. width: 1em;
  41. height: 1em;
  42. fill: currentColor;
  43. overflow: hidden;
  44. }
  45. </style>