h5 获取经纬度

1
2
3
4
5
6
7
8
9
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition((res) => {
console.log("经度" + res.coords.longitude + "纬度" + res.coords.latitude)
})
} else {
alert("Geolocation is not supported by this browser.")
}
}

nuxt3 ssg 报错问题处理

可以在 nuxt.config.ts 中添加如下配置试试

1
2
3
4
5
6
7
8
9
10
11
12
13
14
nitro: {
routeRules: {
'/*': {
cors: true,
},
},
prerender: {
crawlLinks: true,
failOnError: false,
},
externals: {
traceInclude: [],
},
}