Looking to create a unique vue.js template that functions as described below:
should produce<CustomComponent></CustomComponent>
<div class="a"></div>
should result in<CustomComponent>b</CustomComponent>
.<div class="a" data-text="b"></div>
Is it possible to achieve this functionality?
UPDATE
Below is the closest solution I've come up with:
props: {
text: {
type: [Boolean, String],
default: false
}
},
and the corresponding template:
<template>
<div :class="classes()" :data-text="text">
<slot v-bind:text="text"></slot>
</div>
</template>
However, there seems to be an issue with the binding, as text
always returns false
.