Package Exports
- ra-data-leancloud
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ra-data-leancloud) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ra-data-leancloud
A LeanCloud data provider for react-admin.
Features
- 支持 JavaScript 和 TypeScript
- 支持内嵌查询
Installation
yarn add ra-data-leancloud
# or
npm i ra-data-leancloud --saveUsage
// App.jsx or App.tsx
import dataProvider from "ra-data-leancloud"
import AV from "leancloud-storage"
// init leancloud storage before use the data provider
AV.init({
appId: "appId",
appKey: "appKey"
})
dataProvider.init({ AV })
export default () => (
<Admin dataProvider={dataProvider}>
{/* name should be the class name in your leancloud storage service */}
<Resource name="Todo" />
</Admin>
)内嵌查询:
// SomeList.jsx or SomeList.tsx
<List filter={{ "todo.folder": targetFolder }} />Tips:
- 内嵌查询有一定限制,详情查看 LeanCloud 官方说明
- 内嵌查询要求字段名称和 class 的名称一致,只是首字母变为小写。如
todo字段指向Todoclass 中的数据。- 内嵌查询可以有多个层级,如
a.b.c.d.e
Change Log
Please refer to CHANGELOG.md.
License
MIT.