question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use photo-sphere-viewer plugins in vue project

See original GitHub issue

Hello Dear

Thank you! I have found answer in issue #368. Thank you all the same.

I used the photo-sphere-viewer 4.0.5 version in vue project. Now I have met a strange problem. I used like this completely copying from guide . html is as below:

<div id="viewer"></div>

js part is as:

import * as PSV from 'photo-sphere-viewer';
import 'photo-sphere-viewer/dist/photo-sphere-viewer.css';

export default {
  mounted() {
    this.initPhotoSphere();
  },
  methods: {
    initPhotoSphere() {
      const viewer = new PSV.Viewer({
        container: document.getElementById('viewer'),
        // panorama: this.factoryLink,
        panorama: 'https://photo-sphere-viewer.js.org/assets/sphere.jpg',
        size: {
          width: '100%',
          height: screen.availHeight,
        },
        loadingImg: 'https://photo-sphere-viewer.js.org/assets/photosphere-logo.gif',
        caption: '街景图',
        defaultLat: 0.3,
        plugins: [
          [PSV.MarkersPlugin, {
            markers: [ 
              {
                id: 'new-marker',
                longitude: '45deg',
                latitude: '0deg',
                image: 'https://photo-sphere-viewer.js.org/assets/pin-red.png',
              },
            ],
          }] 
        ],
      });
      console.log(viewer);
    }
  }
}

But in my last console.log, I can not find the plugins in viewer.

I trace in the photo-sphere-view source code. I print ‘plugins’ in ‘photo-sphere-viewer.js’ line 3200, I got a result of

 [undefined, {markers: Array(1)}]

I think maybe the undefined in the 0 index cause the problem. But I don’t know why it will add the undefined in the first. Then I changed to other plugins, the problem is the same. Hoping for your professional explanations. Thank you for your help!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mistic100commented, Apr 22, 2022

In two years things changed. The documentation is correct.

0reactions
gleathermancommented, Apr 22, 2022

agreed, the Plugins intro page for ES includes still shows mustaches in the import line, which is not what @mistic100 comment above defines

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introduction to plugins - Photo Sphere Viewer
Plugins are used to add new functionalities to Photo Sphere Viewer. They can access all internal APIs of the viewer as well as...
Read more >
photo-sphere-viewer-embed - npm package - Snyk
Ensure you're using the healthiest npm packages. Snyk scans all the packages in your projects for vulnerabilities and provides automated fix ...
Read more >
【VUEJS】photo sphere viewer 360°×180° panoramic plug in ...
https://politicnewsbusterinsiderpostreview.blogspot.com/2021/04/vuejsphoto-sphere-viewer-360180.html with ❤ by Edward Lance Lorilla Apache ...
Read more >
Vue使用photo-sphere-viewer360°×180°全景插件模拟VR看房
2. 按参考的文章导入发现获取不到 MarkersPlugin. 在 node_modules\photo-sphere-viewer\dist\plugins\ ...
Read more >
cordova-plugin-panoramaviewer: Documentation | Openbase
I created this plugin for the purposes of my project and decided to make it public. Photosphere plugin uses the Panorama API and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found