Skip to content

Commit

Permalink
feat: messages 支持数据渲染
Browse files Browse the repository at this point in the history
  • Loading branch information
shenmenga committed Feb 28, 2024
1 parent e2db651 commit d1cfd37
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion examples/components/CRUD/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,16 @@ export default {
body: {
type: 'form',
name: 'sample-edit-form',
api: '/api/sample/$id',
data:{
env: 'test'
},
api: {
method:'post',
url:'/api/sample/$id',
messages:{
success: '成功了-${env}'
}
},
body: [
{
type: 'input-text',
Expand Down
4 changes: 2 additions & 2 deletions packages/amis-core/src/store/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {ServerError} from '../utils/errors';
import {normalizeApiResponseData} from '../utils/api';
import {replaceText} from '../utils/replaceText';
import {concatData} from '../utils/concatData';

import {filter} from 'amis-core';
export const ServiceStore = iRendererStore
.named('ServiceStore')
.props({
Expand Down Expand Up @@ -54,7 +54,7 @@ export const ServiceStore = iRendererStore
}

function updateMessage(msg?: string, error: boolean = false) {
self.msg = (msg && String(msg)) || '';
self.msg = (msg && filter(msg, self.data)) || '';
self.error = error;
}

Expand Down

0 comments on commit d1cfd37

Please sign in to comment.