index.vue 539 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <template>
  2. <div class="icon-image">
  3. <img :src="imageSrc" :alt="alt" />
  4. </div>
  5. </template>
  6. <script>
  7. import { mapGetters } from 'vuex'
  8. export default {
  9. props: {
  10. name: {
  11. type: String,
  12. default: '',
  13. },
  14. alt: {
  15. type: String,
  16. default: '',
  17. },
  18. },
  19. computed: {
  20. ...mapGetters(['static']),
  21. imageSrc() {
  22. return this.static + '/' + this.name
  23. },
  24. },
  25. }
  26. </script>
  27. <style scoped lang="scss">
  28. .icon-image {
  29. img {
  30. display: block;
  31. width: 100%;
  32. height: 100%;
  33. }
  34. }
  35. </style>