dbsd_kczx/src/utils/desform/customExpression.ts

30 lines
923 B
TypeScript
Raw Normal View History

/*
*
*
* Online表单的默认值表达式中使用
* 使 export
*
* export const name = '张三'; // const 是常量
* export let age = 17; // 看情况 export const 还是 let ,两者都可正常使用
* export function content(arg) { // export 方法可传参数使用时要加括号值一定要return回去可以返回Promise
* return 'content' + arg;
* }
* export const address = (arg) => content(arg) + ' | 北京市'; // export 箭头函数也可以
*
*/
/** 字段默认值官方示例:获取地址 */
export function demoFieldDefVal_getAddress(arg) {
if (!arg) {
arg = '朝阳区'
}
return `北京市 ${arg}`
}
/** 自定义JS函数示例 */
export function sayHi(name) {
if (!name) {
name = '张三'
}
return `您好,我叫: ${name}`
}