index.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <!-- 全景图 -->
  2. <template>
  3. <div class='travel'>
  4. <iframe :src="iframeLink"></iframe>
  5. <div v-if="!isMobile" class="goBack" @click="goBack()"><img src="../../assets/images/goback.png" alt=""></div>
  6. </div>
  7. </template>
  8. <script>
  9. //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  10. //例如:import 《组件名称》 from '《组件路径》';
  11. import browser from "@/utils/browser.js";
  12. export default {
  13. //import引入的组件需要注入到对象中才能使用
  14. inject:['reload'],
  15. components: {},
  16. data() {
  17. //这里存放数据
  18. return {
  19. iframeLink:"",
  20. isMobile: browser.mobile,
  21. };
  22. },
  23. //监听属性 类似于data概念
  24. computed: {},
  25. //监控data中的数据变化
  26. watch: {
  27. },
  28. //方法集合
  29. methods: {
  30. goBack() {
  31. history.go(-1)
  32. }
  33. },
  34. //生命周期 - 创建完成(可以访问当前this实例)
  35. created() {
  36. this.iframeLink = this.$route.query.travelAround;
  37. },
  38. //生命周期 - 挂载完成(可以访问DOM元素)
  39. mounted() {
  40. },
  41. beforeCreate() {}, //生命周期 - 创建之前
  42. beforeMount() {}, //生命周期 - 挂载之前
  43. beforeUpdate() {}, //生命周期 - 更新之前
  44. updated() {}, //生命周期 - 更新之后
  45. beforeDestroy() {}, //生命周期 - 销毁之前
  46. destroyed() {}, //生命周期 - 销毁完成
  47. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  48. }
  49. </script>
  50. <style lang='less' scoped>
  51. //@import url(); 引入公共css类
  52. .travel {
  53. width:100%;
  54. height:100%;
  55. iframe {
  56. width:100%;
  57. height:100%;
  58. }
  59. .goBack {
  60. position:absolute;
  61. top:26px;
  62. left:20px;
  63. cursor: pointer;
  64. }
  65. }
  66. </style>