0.0.2 • Published 2 years ago
gm-vr-map v0.0.2
gm-vr-map
vr全景图
安装
npm install gm-vr-map
使用
- json
{
"usingComponents": {
"vr-map": "gm-vr-map/vr-map"
}
}
- js
Page({
data: {
curIdx: -1,
},
showMap() {
// 设置对应下标,自动显示地图 有效值范围:(0-13)
this.setData({ curIdx: 1 })
},
closeMap() {
this.setData({ curIdx: -1 })
},
onClick(idx) {
if (idx == -1) {
// 关闭地图
this.closeMap();
} else {
// 切换场景
console.log("scene:", idx)
}
},
})
- xaml
<block a:if="{{0<=curIdx && curIdx < 14}}">
<vr-map curIdx="{{curIdx}}" onClick="onClick" rotate="{{true}}" />
</block>
<view onTap="showMap" style="position:fixed;left:0;bottom:0;">显示地图</view>