How to check has a input or not in custom component?

    var ix = Component.Params.IndexOfName("v");
    var has_input = Component.Params.Input[ix].SourceCount > 0;

Or if you keep track of the (input) Params index yourself:

    var has_input = Component.Params.Input[0].SourceCount > 0;
    if (has_input) 
        Component.Message = "has input" ;
    else
        Component.Message = "no input" ;

Be aware if Output params because no event is fired when changing them, so your code wouldn’t be updated when removing a wire. On the Inputs it works though. (See the problem with updating Outputs in this post from yesterday)

// Rolf