I've been using an ancient device called a flickstand for that. It attaches to the down tube and wedges against the tire.
There's a modern steering lock that's basically an extra bar that swings down from the handlebars and fits on to a ball on the top tube, I think. Seemed expensive, though.
It doesn't automatically undo itself on riding forward like the flickstand either. So seems less convenient.