可以用JavaScript完成吗?
type == 1 ? function1() : function2();
javascript ternary-operator
javascript ×1
ternary-operator ×1