Icon.vue 856 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template lang="html">
  2. <svg v-if="!loading" class="icon" :class="'icon-'+ name" :width="width" :height="height">
  3. <use v-bind="{ 'xlink:href': '/svg/symbol/' + src() + name }" />
  4. </svg>
  5. <v-progress-circular
  6. v-else
  7. :width="1"
  8. :size="10"
  9. indeterminate
  10. ></v-progress-circular>
  11. </template>
  12. <script>
  13. export default {
  14. data() {
  15. return {
  16. loading: true
  17. }
  18. },
  19. mounted() {
  20. this.loading = false
  21. },
  22. methods: {
  23. src() {
  24. if (this.clear) {
  25. return "sprite-clear.svg#";
  26. } else {
  27. return "sprite-styled.svg#";
  28. }
  29. },
  30. },
  31. props: {
  32. name: String,
  33. clear: Boolean,
  34. iconClass: {
  35. type: String,
  36. },
  37. width: {
  38. type: [Number, String],
  39. },
  40. height: {
  41. type: [Number, String],
  42. },
  43. },
  44. };
  45. </script>
  46. <style lang="less">
  47. </style>