diff --git a/examples/app/app.tsx b/examples/app/app.tsx index ae1c66074..f90e3b0ae 100644 --- a/examples/app/app.tsx +++ b/examples/app/app.tsx @@ -1,6 +1,7 @@ export default { type: 'app', brandName: 'APP 模式', + api: '/api/mock2/sample', // logo: // '', header: { @@ -44,6 +45,7 @@ export default { { label: '页面A-2', url: '2', + schema: { type: 'page', title: '页面A-2', @@ -91,6 +93,8 @@ export default { label: '列表', url: '/crud/list', icon: 'fa fa-list', + badge: '${count}', + badgeClassName: 'bg-info', schemaApi: '/api/mock2/service/schema?type=crud' } ] diff --git a/packages/amis-core/src/store/app.ts b/packages/amis-core/src/store/app.ts index 0bfe0e157..843f5a06c 100644 --- a/packages/amis-core/src/store/app.ts +++ b/packages/amis-core/src/store/app.ts @@ -9,7 +9,7 @@ import { mapTree } from '../utils/helper'; import {ServiceStore} from './service'; -import {isVisible} from '../utils'; +import {filter, isVisible, resolveVariableAndFilter} from '../utils'; export const AppStore = ServiceStore.named('AppStore') .props({ @@ -39,7 +39,12 @@ export const AppStore = ServiceStore.named('AppStore') path: item.path, children: item.children, className: item.className, - visible + visible, + badge: + typeof item.badge === 'string' + ? filter(item.badge, self.data) + : item.badge, + badgeClassName: filter(item.badgeClassName, self.data) }; }); }