Skip to content

Instantly share code, notes, and snippets.

CaitlinWeb-st / SlotWrapper.js
Created November 4, 2020 21:13
Vue component for slots to ensure each element has class(es) or tag
View SlotWrapper.js
* Ensures each child node (element or text) of the slot has a given tag or class.
export default {
name: "SlotWrapper",
functional: true,
props: ["tag", "value"],
render: function(h, ctx) {
const { tag = "div", value: node, class: className = "" } = ctx.props;