UNPKG

ht-data-formatting-view

Version:

A Vue component for data formatting view

28 lines (26 loc) 543 B
"use strict"; import DOMPurify from "dompurify"; const safeHtml = {}; safeHtml.install = function install(Vue) { Vue.component("safe-html", { props: { content: { type: String, required: true }, tag: { type: String, default: "div" } }, render(h) { return h(this.tag, { class: "safe-html-container", domProps: { innerHTML: DOMPurify.sanitize(this.content) } }); } }); } export default safeHtml;