mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-18 03:33:40 +00:00
feat: 🎸 与国凯的数据源保持一致,将 urlParams 所需的 search 参数直接传入
This commit is contained in:
parent
b9a562eeab
commit
19fabc1760
@ -46,7 +46,7 @@ const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) =>
|
|||||||
|
|
||||||
requestHandlersMap[ds.type] = {
|
requestHandlersMap[ds.type] = {
|
||||||
type: 'JSExpression',
|
type: 'JSExpression',
|
||||||
value: handlerName + (ds.type === 'urlParams' ? '({ search: this.props.location.search })' : ''),
|
value: handlerName + (ds.type === 'urlParams' ? '(this.props.location.search)' : ''),
|
||||||
};
|
};
|
||||||
|
|
||||||
next.chunks.push({
|
next.chunks.push({
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class Home$$Page extends Component {
|
|||||||
_dataSourceEngine = __$$createDataSourceEngine(this._dataSourceConfig, this._context, {
|
_dataSourceEngine = __$$createDataSourceEngine(this._dataSourceConfig, this._context, {
|
||||||
runtimeConfig: true,
|
runtimeConfig: true,
|
||||||
requestHandlersMap: {
|
requestHandlersMap: {
|
||||||
urlParams: __$$urlParamsRequestHandler({ search: this.props.location.search }),
|
urlParams: __$$urlParamsRequestHandler(this.props.location.search),
|
||||||
fetch: __$$fetchRequestHandler,
|
fetch: __$$fetchRequestHandler,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import qs from 'query-string';
|
import qs from 'query-string';
|
||||||
import { RequestHandler } from '../types';
|
import { RequestHandler } from '../types';
|
||||||
|
|
||||||
export default function urlParamsHandler({ search }: { search: string | Record<string, unknown> }): RequestHandler {
|
export default function urlParamsHandler(search: string | Record<string, unknown>): RequestHandler {
|
||||||
const urlParams = typeof search === 'string' ? qs.parse(search) : search;
|
const urlParams = typeof search === 'string' ? qs.parse(search) : search;
|
||||||
|
|
||||||
return async () => {
|
return async () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user