index.vue 783 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <img :class="className" :src="url" />
  3. </template>
  4. <script lang="ts">
  5. import Vue from 'vue';
  6. export default Vue.extend({
  7. name: 'thumbnail',
  8. props: {
  9. url: {
  10. type: String,
  11. default: '',
  12. },
  13. type: {
  14. type: String,
  15. default: 'layout',
  16. },
  17. },
  18. computed: {
  19. className() {
  20. return [
  21. 'thumbnail-container',
  22. {
  23. 'thumbnail-circle': this.type === 'circle',
  24. 'thumbnail-layout': this.type === 'layout',
  25. },
  26. ];
  27. },
  28. },
  29. });
  30. </script>
  31. <style lang="less" scoped>
  32. @import url('@/style/index.less');
  33. .thumbnail {
  34. &-container {
  35. display: inline-block;
  36. }
  37. &-circle {
  38. border-radius: var(--td-radius-circle);
  39. }
  40. &-layout {
  41. width: 88px;
  42. height: 48px;
  43. }
  44. }
  45. </style>