Merge pull request #7280 from igrowp/fix-page-params

fix: 事件动作 -> 页面变量列表为空,无法选择 & 勾选框组件默认值配置fx无效
This commit is contained in:
wutong 2023-06-27 20:38:31 +08:00 committed by GitHub
commit 84393de36c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 13 deletions

View File

@ -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') {

View File

@ -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
}
}}
/>
);
}

View File

@ -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'),