viewer.getPlugin(PhotoSphereViewer.MarkersPlugin) return 空
viewer.getPlugin(PhotoSphereViewer.MarkersPlugin) return null
我用PhotosphereViewer显示全景图
我使用以下代码成功初始化查看器 -
var viewer = new PhotoSphereViewer.Viewer({
panorama: '/images/myimage.jpg',
container: 'stage',
loadingImg: 'https://photo-sphere-viewer.js.org/assets/photosphere-logo.gif',
caption: 'Parc national du Mercantour <b>© Damien Sorel</b>',
defaultLat: 0.3,
plugins: [
[PhotoSphereViewer.MarkersPlugin, {
// list of markers
markers: [
]
}]
]
});
初始化查看器后,我使用以下命令获取对 MarkersPlugin 的引用 -
var markersPlugin = viewer.getPlugin(PhotoSphereViewer.MarkersPlugin);
知道为什么 markersPlugin
总是 null 吗?
也许您需要在标记中添加一些内容,如示例所示
https://photo-sphere-viewer.js.org/plugins/plugin-markers.html#usage
您需要在 html
中添加 markers.js
文件
喜欢
<script src="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/plugins/markers.js"></script>
我用PhotosphereViewer显示全景图
我使用以下代码成功初始化查看器 -
var viewer = new PhotoSphereViewer.Viewer({
panorama: '/images/myimage.jpg',
container: 'stage',
loadingImg: 'https://photo-sphere-viewer.js.org/assets/photosphere-logo.gif',
caption: 'Parc national du Mercantour <b>© Damien Sorel</b>',
defaultLat: 0.3,
plugins: [
[PhotoSphereViewer.MarkersPlugin, {
// list of markers
markers: [
]
}]
]
});
初始化查看器后,我使用以下命令获取对 MarkersPlugin 的引用 -
var markersPlugin = viewer.getPlugin(PhotoSphereViewer.MarkersPlugin);
知道为什么 markersPlugin
总是 null 吗?
也许您需要在标记中添加一些内容,如示例所示 https://photo-sphere-viewer.js.org/plugins/plugin-markers.html#usage
您需要在 html
中添加markers.js
文件
喜欢
<script src="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/plugins/markers.js"></script>