Mollie is 11months old,she is sociable with other dogs and has never been reactive on or off lead. We have been in Spain over the winter and have often sat outside at bars for coffee or a meal. She lies or sits beside the table,generally no trouble at all,however for the past few weeks if a dog or cat approaches the table,(usually they are strays but not always) or even passes it, her hackles rise and she barks and strains to get to them,she sounds very aggresive and it is difficult to get her attention

This is happening more frequently and i want to 'nip it in the bud'

It never happens when we are out walking

Does anyone have any idea why she does this ?
I have been trying to keep her attention on me by giving treats when i see dogs heading our way and that seems to be having some effect ,but i'm not sure if i am doing the right thing,or if there is anything else i should try

.
Any advice on how to deal with this would be much appreciated. Thankyou.