From d1af07be7d4d8d99f620bbd4fd3488c865af7d6c Mon Sep 17 00:00:00 2001 From: liaoxuezhi <2betop.cn@gmail.com> Date: Thu, 6 Jul 2023 20:16:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20App=20=E5=BA=94=E7=94=A8=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=AE=BE=E7=BD=AE=E8=8F=9C=E5=8D=95=E5=BE=BD=E6=A0=87?= =?UTF-8?q?=20Close:=20#7380=20(#7384)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/app/app.tsx | 4 ++++ packages/amis-core/src/store/app.ts | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) 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) }; }); }