let fun_str = value; //例:function(a,b){return a.value+b.value} try { fun_str = fun_str.replace(/[ ]/g, ""); let fun;//this is useful let func = 'fun=' + fun_str; let result = eval(func)(a, b); return result; } catch (err) { console.error(fun_str); console.log(a, b) return true; }
用于用户界面配置生成function