Questions tagged [renderless-component]

7 questions
5
votes
1 answer

Renderless Vue Component in TypeScript

I have a renderless component in JavaScript that I am trying to convert to TypeScript. I'm running into errors declaring the render function in a Vue.extend-ed component: (method) ComponentOptions
4
votes
0 answers

Renderless Components in Vue 3

I have built a pagination component in Vue 2 using the renderless pattern to separate behavior from presentation and allow the consumer to compose his own UI…
Matanya
  • 6,233
  • 9
  • 47
  • 80
2
votes
1 answer

Pass ref to default slot in renderless component

I am trying to build a renderless component in vue 3 and want to pass a ref to the default slot. When I am using the h render function I can just pass a ref: return h('div', {ref: someRef}); // works If I try to do the same with the default slot,…
Marco
  • 1,579
  • 1
  • 19
  • 34
1
vote
0 answers

Can I make 3 errors types without if/else with Vue.js?

Can I make 3 errors types without if/else? I need to show 3 types of errors (they have different positions): common errorLogin errorPassword What I have now: I made a renderless function. And I see 2 ways: use if/else in the template of the…
0
votes
1 answer

Class Attribute Overwritten in Renderless Vue Component

I've built a renderless base icon Vue component that just outputs whatever is in its slot but with some additional attributes added to the slotted component. One of the attributes I set is class="icon" which allows me to have my styles for all icons…
Muhammad Rehan Saeed
  • 35,627
  • 39
  • 202
  • 311
0
votes
0 answers

Detect a template v-slot in a renderless component

I've done a renderless component in VueJS and I try to detect if inside the component, there is a template with a v-slot or not. The objective is to conditional render the code inside the renderless component "Read" bellow. For example, what I need…
0
votes
1 answer

v-model inside a renderless component

CodeSandbox: https://codesandbox.io/s/61my3w7xrw?fontsize=14 I have this renderless component that uses a scoped slot: name: "BlockElement", props: { element: { type: Object, required: true } }, data() { return { …
eozzy
  • 66,048
  • 104
  • 272
  • 428