index.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <div class="hotspotcon" @mousemove.stop>
  3. <component @close="close" :type="scene" :is="active" :hotspot="hotspot"></component>
  4. </div>
  5. </template>
  6. <script>
  7. import audio from './audio.vue';
  8. import image from './image.vue';
  9. import video from './video.vue';
  10. import title from './title.vue';
  11. import iframe from './iframe.vue';
  12. import model from './model.vue';
  13. let iconArr = [
  14. { name: "视频", key: "video", id: "vVideo", img: "video-icon", display: false },
  15. { name: "网页", key: "iframe", id: "vIframe", img: "iframe-icon", display: false },
  16. { name: "图片", key: "images", id: "vImage", img: "img-icon", display: false },
  17. { name: "模型", key: "model", id: "vModel", img: "model-icon", display: false },
  18. { name: "介绍", key: "title", id: "vTitle", img: "txt-icon", display: false }
  19. ];
  20. export default {
  21. props:['hotspot'],
  22. components:{
  23. vAudio:audio,
  24. vImage:image,
  25. vIframe:iframe,
  26. vTitle:title,
  27. vVideo:video,
  28. vModel:model,
  29. },
  30. methods:{
  31. close(){
  32. this.$emit('close')
  33. }
  34. },
  35. mounted(){
  36. // console.log(this.hotspot);
  37. iconArr.forEach(item => {
  38. if (this.hotspot[item.key]) {
  39. this.active = !this.active ? item.id : this.active;
  40. }
  41. });
  42. !this.active && (this.active = 'vTitle')
  43. },
  44. data(){
  45. return {
  46. active:''
  47. }
  48. },
  49. computed:{
  50. scene(){
  51. return this.$route.params.type
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang="less" scoped>
  57. .hotspotcon{
  58. position: fixed;
  59. z-index: 9999;
  60. width: 100%;
  61. height: 100%;
  62. left: 0;
  63. top: 0;
  64. .close{
  65. position: fixed;
  66. top: 40px;
  67. right: 40px;
  68. width: 30px;
  69. height: 70px;
  70. cursor: pointer;
  71. }
  72. .ifrclose{
  73. top: 100px;
  74. }
  75. }
  76. </style>