w3cschool通过本文主要向大家介绍了微信小程序云开发服务端数据库API 地理位置构造器等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
微信小程序云开发服务端数据库API 地理位置构造器
function Point(longitude: number, latitude: number): Point
方法接受两个必填参数,第一个是经度(longitude),第二个是纬度(latitude),务必注意顺序
示例代码
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database()
exports.main = async (event, context) => {
try {
return await db.collection('todos').add({
description: 'eat an apple',
location: new db.Geo.Point(113, 23)
})
} catch(e) {
console.error(e)
}
}