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

Create slots inside slot-block error #5

Open
likemusic opened this issue Sep 6, 2020 · 3 comments
Open

Create slots inside slot-block error #5

likemusic opened this issue Sep 6, 2020 · 3 comments

Comments

@likemusic
Copy link

<!-- TestBase.vue -->
<template>
  <div>
    <h1>Base Component</h2>
    <div>
      <slot name="body">Component body</slot>
    </div>
  </div>
</template>
...
<!-- TestChild component -->
<slot name="body">
  <div>
      <span>Overrided body content</span>
      <slot name="form">Your form content</slot>
  </div>
</slot>
 
<script>
export default {
    extends: TestBase
}
</script> 
<!-- TestSubChild component -->
<slot name="form">
  <div>SubChild form content</div>
</slot>
 
<script>
export default {
    extends: TestChild
}
</script> 

This thows an error:

vue.common.dev.js?4650:630 [Vue warn]: Error in created hook: "TypeError: Cannot read property 'bind' of undefined"

found in

---> <TestSubChild> at resources/js/Domain/Test/TestSubChild.vue
       <Root>

image

@likemusic
Copy link
Author

I found many other issues with current implementation.

For my requirements I made some fixes in fork's inheritable-branch. Maybe it will help someone.

@likemusic
Copy link
Author

As result of my investigation, I think it would be better to implement this package functionality by injecting slots in template-code. But I'm not sure that this is really possible.

@likemusic
Copy link
Author

After many fixes and debugging I have created my own loader - vue-template-extends - that implemented by setting render functions for component options ( render and staticRenderFns) (because template-option is not respected in SFC).

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

No branches or pull requests

1 participant