YGmang When selecting an image attachment in the viewport, it is difficult for Spine to automatically determine that the user is attempting to select a slot rather than the attachment itself. In most cases, users would prefer to select an attachment in the viewport and then proceed to perform operations such as mesh editing.
While filtering is indeed one possible solution, using a hotkey is the most appropriate solution in this case.
By default, no keys are assigned, but there is a hotkey named Select - Slots
in the Selection section of the hotkey.txt file:

Assigning any key to this will allow you to switch the selection from the attachment to the slot by pressing the hotkey after selecting the attachment.