Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tabs在vue下会报错,子表单不支持records选项,主表单是支持的 invalid label 最好改为原始值,比较友好 #9806

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/amis-core/src/store/formItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,7 @@ export const FormItemStore = StoreNode.named('FormItemStore')
json.data?.options ||
json.data?.items ||
json.data?.rows ||
json.data?.records ||
json.data ||
[];

Expand Down Expand Up @@ -906,7 +907,7 @@ export const FormItemStore = StoreNode.named('FormItemStore')
return;
}

const result = json.data?.items || json.data?.rows;
const result = json.data?.items || json.data?.rows || json.data?.records;
// 只处理仅有一个结果的数据
if (result?.length === 1) {
return result[0];
Expand Down Expand Up @@ -997,6 +998,7 @@ export const FormItemStore = StoreNode.named('FormItemStore')
json.data?.options ||
json.data.items ||
json.data.rows ||
json.data.records ||
json.data ||
[];
const newLeftOptions = spliceTree(topOption.leftOptions, leftIndexes, 1, {
Expand Down Expand Up @@ -1142,6 +1144,7 @@ export const FormItemStore = StoreNode.named('FormItemStore')
json.data?.options ||
json.data.items ||
json.data.rows ||
json.data.records ||
json.data ||
[];

Expand Down Expand Up @@ -1241,6 +1244,7 @@ export const FormItemStore = StoreNode.named('FormItemStore')
json.data?.options ||
json.data.items ||
json.data.rows ||
json.data.records ||
json.data ||
[];

Expand Down
4 changes: 3 additions & 1 deletion packages/amis-core/src/utils/labelToString.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import isPlainObject from 'lodash/isPlainObject';

export function labelToString(label: any): string {
const type = typeof label;
console.log(type);
if (type === 'string') {
return label;
} else if (type === 'number') {
Expand All @@ -16,5 +17,6 @@ export function labelToString(label: any): string {
}
}

return 'invalid label';
// return 'invalid label';
return label;
}
2 changes: 1 addition & 1 deletion packages/amis/src/renderers/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
const location = props.location;
let tab: TabSource | null = null;

if (location && Array.isArray(localTabs)) {
if (location && Array.isArray(localTabs) && location.hash) {
const hash = location.hash.substring(1);
tab = find(localTabs, tab => tab.hash === hash) as TabSource;
}
Expand Down
Loading