Vegetables and fruits don't die the moment they are harvested. They respond to their environment for days.

Vegetables and fruits don’t die the moment they are harvested. They respond to their environment for days.

As long as the vegetable/fruit is fresh looking – i.e. the cells have not disintegrated – they will be respiring, many cells will be functioning quite normally, and the plant is still technically alive.

Source