赞
踩
- npm install @photo-sphere-viewer/core
- /***插件安装**/
- npm install @photo-sphere-viewer/markers-plugin
- npm install @photo-sphere-viewer/gallery-plugin
- npm install @photo-sphere-viewer/autorotate-plugin
-
- <template>
- <div id="viewer"></div>
- </template>
-
- <script>
- import { Viewer } from "@photo-sphere-viewer/core";
- import { MarkersPlugin } from "@photo-sphere-viewer/markers-plugin";
- import { GalleryPlugin } from "@photo-sphere-viewer/gallery-plugin";
- import { AutorotatePlugin } from "@photo-sphere-viewer/autorotate-plugin";
- import "@photo-sphere-viewer/core/index.css";
- import "@photo-sphere-viewer/markers-plugin/index.css";
- import "@photo-sphere-viewer/gallery-plugin/index.css";
- export default {
- props: {
- hasAnimate: {
- type: Boolean,
- default: true,
- },
- imgList: [],
- hasGallery: {
- type: Boolean,
- default: true,
- },
- },
- components: {},
- data() {
- return {
- viewer: "",
- panoramaUrl: "",
- markersPlugin: "",
- autorotatePlugin: "",
- galleryPlugin: "",
- currIndex: 0,
- animatedValues: {
- pitch: { start: -Math.PI / 2, end: 0.2 },
- yaw: { start: Math.PI, end: 0 },
- zoom: { start: 0, end: 50 },
- fisheye: { start: 2, end: 0 },
- },
- defaultUrl: require("../assets/3.jpg"),
- };
- },
- created() {},
- mounted() {
- this.panoramaUrl = this.imgList[0].panorama || this.defaultUrl;
- this.initViewer();
- this.handelListenerViewerClick();
- this.handleSelectMarker();
- this.handleHoverMarker();
- this.handleLeaveMarker();
- this.$nextTick(() => {
- this.handleGalleryChange();
- });
- },
- watch: {},
- methods: {
- initViewer() {
- const _this = this;
- this.viewer = new Viewer({
- container: "viewer",
- panorama: this.panoramaUrl || this.defaultUrl,
- caption: "test",
- loadingImg: require("../assets/loader.gif"),
- touchmoveTwoFingers: true,
- mousewheelCtrlKey: false,
- navbar: [
- "autorotate",
- "zoom",
- "markers",
- "move",
- "download",
- "gallery",
- {
- title: "Change points",
- content: "声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/326112推荐阅读
相关标签
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。