index.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <div class="bs-design-wrap bs-picture">
  3. <div class="content-box">
  4. <el-image
  5. :src="getCoverPicture(config.customize.url) || noImageUrl"
  6. fit="fill"
  7. :style="{
  8. width: '100%',
  9. height: '100%',
  10. opacity: config.customize.opacity,
  11. borderRadius: config.customize.radius + 'px'
  12. }"
  13. draggable="false"
  14. >
  15. <div
  16. slot="placeholder"
  17. class="image-slot"
  18. >
  19. 加载中···
  20. </div>
  21. </el-image>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import { getFileUrl } from 'data-room-ui/js/utils/file'
  27. import { refreshComponentMixin } from 'data-room-ui/js/mixins/refreshComponent'
  28. export default {
  29. name: 'PictureChart',
  30. components: {},
  31. mixins: [refreshComponentMixin],
  32. props: {
  33. config: {
  34. type: Object,
  35. default: () => ({})
  36. }
  37. },
  38. data () {
  39. return {
  40. noImageUrl: require('data-room-ui/BasicComponents/Picture/images/noImage.png')
  41. }
  42. },
  43. computed: {},
  44. watch: {},
  45. mounted () {},
  46. methods: {
  47. /**
  48. * 获取图片访问地址,如果是相对路径则拼接上文件访问前缀地址
  49. * @param url
  50. * @returns {*}
  51. */
  52. getCoverPicture (url) {
  53. return getFileUrl(url)
  54. },
  55. }
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. .bs-design-wrap {
  60. width: 100%;
  61. background-color: rgba(0, 0, 0, 0);
  62. .content-box {
  63. width: 100%;
  64. height: 100%;
  65. }
  66. }
  67. </style>