A custom directive in a Vue template[0], is quite similar to your example with an inline expression in an hypertext literal. Maybe a little less elegant.
But d3.select is still needed to select the bound dom element ;-)
[0] https://stackoverflow.com/questions/48726636/draw-d3-axis-wi...