Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slot support for Badge component #1207

Closed
ZakyAbanoub opened this issue Apr 23, 2021 · 0 comments
Closed

Slot support for Badge component #1207

ZakyAbanoub opened this issue Apr 23, 2021 · 0 comments
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@ZakyAbanoub
Copy link

ZakyAbanoub commented Apr 23, 2021

Bug:

Using Badge component, I have to use value and I can't use slots

Fix:

I tried to change the badge component in node modules in badge.esm.js

import { openBlock, createBlock, toDisplayString, renderSlot } from 'vue';
'p-badge-dot': !this.value && !this.$slots.default
function render(_ctx, _cache, $props, $setup, $data, $options) {
    let val = null
    if( this.$slots.default ){
        val = [ renderSlot(_ctx.$slots, "default") ]
    } else {
        val = toDisplayString($props.value)
    }
    return (openBlock(), createBlock("span",{ class: $options.badgeClass }, val, 3))
  }

  script.render = render;

And it works.

What is the motivation?

To generalize the component To give the developer the choice to write everything he wants.

My Env:

OS: Linux, Ubuntu
IDE: VSCode
Vue Version : 3.0.0
PrimeVue Version: 3.4.0
Browser: Chrome

Schermata da 2021-04-23 11-56-12

@cagataycivici cagataycivici changed the title [ Bug Report ] Chip - Slots don't work. Slot support for badge May 10, 2021
@cagataycivici cagataycivici added Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add priority - low labels May 10, 2021
@cagataycivici cagataycivici changed the title Slot support for badge Slot support for badge/chip/tag May 10, 2021
@cagataycivici cagataycivici self-assigned this May 11, 2021
@cagataycivici cagataycivici added this to the 3.5.0 milestone May 11, 2021
@cagataycivici cagataycivici changed the title Slot support for badge/chip/tag Slot support for Badge component May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

No branches or pull requests

2 participants