Component is an alternative for v-html directive allows to include components to html markup. It can be useful for rendering fetched html content and to add it some interactivity.
npm install html2vue-rendererComponent is an alternative for v-html directive allows to include components to html markup. It can be useful for rendering fetched html content and to add it some interactivity.
#### It has some restrictions:
- you have to always close component's tag
- attributes and props names have to be in kebab-case
- events on component are not working yet
- Vue.js 3.x
``bash
npm install html2vue-renderer
yarn add html2vue-renderer
`
`javascript
`
In :some-prop will take any data from docProps['someValue'] and some-other-prop will take string 'some-other-value'
`javascript
`
#### value
Type: HTMLstringtrue
Required:
HTML string can contain vue components defined in componentsMap prop
#### componentsMap
Type: Recordfalse
Required: {}
Default:
Object represents components can be included into HTML markup. Key in this object have to be same with name of component's tag included into markup.
#### docProps
Type: Recordfalse
Required: {}
Default:
Object represents data to be passed to components in the markup. Keys in this object have to be same with the idetifier in the markup.
example:
`javascript
``
#### mounted
event payload: HTMLElement with rendered content
`javascript
`
#### updated
event payload: HTMLElement with re-rendered content
`javascript
``