Pass a function as the
second parameter to oUF:SpawnNamePlates, it will be called whenever a new nameplate unit is used or when the player changes targets.
Then use
UnitIsUnit('target', unit) in that function to check if they match (unit being the 3rd argument passed to the function), and proceed to show/hide your border.
Drycoded example:
Lua Code:
oUF:SpawnNamePlate(nil, function(self, _, unit)
if(UnitExists('target') and UnitIsUnit('target', unit)) then
self.border:Show()
else
self.border:Hide()
end
end)
Shorter version
Lua Code:
oUF:SpawnNamePlate(nil, function(self, _, unit)
self.border:SetShown(UnitExists('target') and UnitIsUnit('target', unit))
end)