我正在努力找出如何在我的 Next JS 应用程序中使用标记。
我有一个基本的全景图和这个代码......
import React, { useEffect } from "react";
import Head from "next/head";
import { Viewer } from "photo-sphere-viewer";
export default function Home() {
const sphereElementRef = React.createRef();
useEffect(() => {
const shperePlayerInstance = new Viewer({
container: sphereElementRef.current,
panorama: "/images/pano2.jpg",
});
// unmount component instructions
return () => {
shperePlayerInstance.destroy();
};
}, []);
return (
<div>
<Head>
<title>Create Next App</title>
<meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/photo-sphere-viewer.min.css"
/>
</Head>
<main>
<div ref={sphereElementRef}></div>
</main>
</div>
);
}
所以这一切都很好,但我不知道标记是如何进入的。我已经尝试过与标记文档中的完全一样
plugins: [
[PhotoSphereViewer.MarkersPlugin, {
markers: [
{
id: 'new-marker',
longitude: '45deg',
latitude: '0deg',
image: 'assets/pin-red.png',
},
],
}],
],
但是得到PSVError: Un undefined value was given for plugins.
而且也只是使用
markers: [
{
id: 'image',
longitude: 0.2,
latitude: -0.13770,
....
},
但我只是得到
PSVError: Unknown option markers
任何想法都会有很大帮助