Compile a template string at runtime

We use quite a few filters in our templates, for example {{ amount | round(2) | format }}, etc. For some more abstract components it would be very handy to pass in a template string like this into a prop and render that template in some context.

Example: <bar-chart :data="dataPoints" popover="€ {{ amount | round(2) | format }} per year"></bar-chart>. The popover text is rendered in the context of each bar.

Is it possible to use the Vue template compiler to compile these templates into functions? We are using SSR, so (as far as I know) we have to load the full build anyway.

I have a working (limited) template renderer using regexes which is not too much code but it’s still a shame to include another template renderer when one is already on board.