uni-app 省市区查询树形结构父节点路径
uni-app 省市区查询树形结构父节点路径
示例代码:
//400毫秒查询
await dbj.collection('opendb-city-china')
.get({
getTreePath: {
startWith: `code=='${result.code}'`
}
})
//30毫秒查询
await dbj.collection('opendb-city-china')
.get({
getTreePath: {
limitLevel: 5,
startWith: `code=='${result.code}'`
}
})
操作步骤:
//400毫秒查询
await dbj.collection('opendb-city-china')
.get({
getTreePath: {
startWith: `code=='${result.code}'`
}
})
//30毫秒查询
await dbj.collection('opendb-city-china')
.get({
getTreePath: {
limitLevel: 5,
startWith: `code=='${result.code}'`
}
})
预期结果:
几十毫秒可以查询出来。
实际结果:
400毫秒查询
bug描述:
await dbj.collection('opendb-city-china')
.get({
getTreePath: {
limitLevel: 5,
startWith: `code=='${result.code}'`
}
})
该查询,如果没有limitLevel参数或者limitLevel为10,查询需要400毫秒。如果limitLevel设置5,则十几毫秒
更多关于uni-app 省市区查询树形结构父节点路径的实战教程也可以访问 https://www.itying.com/category-93-b0.html
2 回复
code导入的时候自带索引的。limitLevel这个应该跟索引没关系吧