Trevor Bodily
Trevor Bodily

Reputation: 131

Rendering an email preview in Vue

I'm creating an internal messaging app in Vue and would like to expose a limited number of predefined variables for a user to choose from when sending a templated message (name, department, etc.).

I'm planning on displaying the rendered variables in a "preview" component which ideally would take the raw html, complete with {{variables}}, fetch the values for the variables and render the preview.

Judging from https://v2.vuejs.org/v2/guide/components there are a number of options that would seem to work, is there an objectively better/worse solution?

Upvotes: 1

Views: 1463

Answers (1)

Shubham Patel
Shubham Patel

Reputation: 3289

I was facing same issue while creating a chart editor.

Instead of sending HTML to the component, you can send a object which consists of your variables as a prop to the component and then render the HTML inside preview components.That will provide live preview feature to the user.

Upvotes: 1

Related Questions