mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
Merge pull request #7280 from igrowp/fix-page-params
fix: 事件动作 -> 页面变量列表为空,无法选择 & 勾选框组件默认值配置fx无效
This commit is contained in:
commit
84393de36c
@ -235,11 +235,11 @@ export class VariableManager {
|
||||
getPageVariablesOptions() {
|
||||
let options: Option[] = [];
|
||||
|
||||
const pageScope = this.dataSchema?.root.children?.filter(
|
||||
item => item.tag === '页面变量'
|
||||
)[0];
|
||||
if (pageScope) {
|
||||
options = pageScope.getDataPropsAsOptions();
|
||||
const rootScope = this.dataSchema?.root;
|
||||
if (rootScope) {
|
||||
options = rootScope
|
||||
.getDataPropsAsOptions()
|
||||
.filter((item: any) => ['__query', '__page'].includes(item.value));
|
||||
}
|
||||
eachTree(options, item => {
|
||||
if (item.type === 'array') {
|
||||
|
@ -160,6 +160,33 @@ const schemas = [
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
__query: {
|
||||
title: '页面入参',
|
||||
type: 'object',
|
||||
required: [],
|
||||
properties: {
|
||||
name: {
|
||||
type: 'string',
|
||||
title: '用户名'
|
||||
}
|
||||
}
|
||||
},
|
||||
__page: {
|
||||
title: '页面变量',
|
||||
type: 'object',
|
||||
required: [],
|
||||
properties: {
|
||||
num: {
|
||||
type: 'number',
|
||||
title: '数量'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
@ -632,6 +659,11 @@ export default class AMisSchemaEditor extends React.Component<any, any> {
|
||||
replaceText
|
||||
} as any
|
||||
}
|
||||
ctx={{
|
||||
__page: {
|
||||
num: 2
|
||||
}
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -148,14 +148,14 @@ export class CheckboxControlPlugin extends BasePlugin {
|
||||
needDeleteProps: ['option'],
|
||||
label: '默认勾选',
|
||||
rendererWrapper: true, // 浅色线框包裹一下,增加边界感
|
||||
valueType: 'boolean',
|
||||
pipeIn: (value: any, data: any) => {
|
||||
return value === (data?.data?.trueValue ?? true);
|
||||
},
|
||||
pipeOut: (value: any, origin: any, data: any) => {
|
||||
const {trueValue = true, falseValue = false} = data;
|
||||
return value ? trueValue : falseValue;
|
||||
}
|
||||
valueType: 'boolean'
|
||||
// pipeIn: (value: any, data: any) => {
|
||||
// return value === (data?.data?.trueValue ?? true);
|
||||
// },
|
||||
// pipeOut: (value: any, origin: any, data: any) => {
|
||||
// const {trueValue = true, falseValue = false} = data;
|
||||
// return value ? trueValue : falseValue;
|
||||
// }
|
||||
}),
|
||||
getSchemaTpl('labelRemark'),
|
||||
getSchemaTpl('remark'),
|
||||
|
Loading…
Reference in New Issue
Block a user