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

Custom element in scopedSlots doesn't work #1053

Closed
renanbronchart opened this issue Dec 4, 2018 · 2 comments
Closed

Custom element in scopedSlots doesn't work #1053

renanbronchart opened this issue Dec 4, 2018 · 2 comments
Labels

Comments

@renanbronchart
Copy link

renanbronchart commented Dec 4, 2018

Version

1.0.0-beta.25

Reproduction link

https://github.com/renanbronchart/gommette/tree/feat/components_accordion

Steps to reproduce

I write test for component Accordion who use scopedSlots with custom component.
But when run my test, the custom component in scoped slot is not register.

I register my component in localVue but it seems doesn't work.

What is expected?

My component custom inner scoped slot should be register

What is actually happening?

My component custom inner scoped slot is not register


My test


      import { GoAccordion, GoCollapse } from '../../../src'

      const localVue = createLocalVue()


      localVue.component('go-collapse', GoCollapse)

      wrapper = mount(GoAccordion, {
        localVue,
        propsData: {
          listItems: newItems
        },
        scopedSlots: {
          default: `<template slot-scope="{ items }">
              <go-collapse
                v-for="(item, key) in items"
                :key="key"
                :index="key"
                :item="item"
                :beDeleted="true"
              />
            </template>
          `
        },
        components: {
           GoCollapse
        }
      })

My errror in console

    [Vue warn]: Unknown custom element: <go-collapse> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
@ronaldborman
Copy link

I have the same problem.

My observation is that when you register the component with the global Vue class, it works (regardless if you use localVue or not). But that pollutes the global Vue class. If you register it on localVue and use that when mounting the component, then the error mentioned above is displayed.

It also only happens with scoped slots because with regular slots the custom element is recognized after you register it on localVue.

@metasean
Copy link

I'm seeing similar errors after a bump up to 1.0.0-beta.27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants