RCLHelperGetClientJSForTryExecFunc Method
构造执行一个客户端函数的 js 脚本。
Namespace: QuickAdmin.RCLAssembly: QuickAdmin.Net (in QuickAdmin.Net.dll) Version: 1.0.122
public static string GetClientJSForTryExecFunc(
string jsFuncName,
string args = null,
bool tryCatchBlock = true
)
- jsFuncName string
- 客户端函数名称。
- args string (Optional)
- 函数参数。
- tryCatchBlock bool (Optional)
- 指示是否加上 try { } catch (e) { } 语句块。
stringjs 脚本。
注意将会把
jsFuncName 与
args 直接拼接,如:
RCLHelper.GetClientJSForTryExecFunc("someFunc", "100, 'abcd', { id: 123, Name: \"Tom\" }")
将返回:
try { if (typeof someFunc === 'function') { someFunc(100, 'abcd', { id: 123, Name: "Tom" }); } else { console.warn('function someFunc() not found.'); } } catch (e) { console.error('someFunc() failed' + (e == undefined ? '.' : (':\n' + e))); }