Merge pull request #9675 from shenmenga/feat-messages

feat: messages 支持数据渲染
This commit is contained in:
hsm-lv 2024-02-29 15:06:21 +08:00 committed by GitHub
commit 25c7cca1d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View File

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

View File

@ -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({
@ -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;
}