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

TypeError: this.$scopedSlots.default is not a function #33

Open
dicktalens opened this issue Jan 19, 2021 · 3 comments
Open

TypeError: this.$scopedSlots.default is not a function #33

dicktalens opened this issue Jan 19, 2021 · 3 comments

Comments

@dicktalens
Copy link

I'm getting the error above upon implementing everything as per the documentation (I'm following the async instructions). Just in case I missed a step, I actually implemented the exact code (below the demo) in a completely new .vue file, and I'm still getting the same error. Any help would be appreciated!

@Niaz-estefaie
Copy link

Niaz-estefaie commented May 10, 2021

The same issue just happened to me.
When I added the whole code which the document said so I'm getting this.$scopedSlots.default is not a function constantly.
The vue version that I'm using is "2.6.12".

@zhuxinping
Copy link

the answer is below ;
getInput () {
this.$scopedSlots;
this.$slots;
console.log(this.$scopedSlots)
console.log(this.$slots)
// debugger
const [vnode] = this.$slots.default;
if (vnode) {
if (vnode.elm.nodeName === 'INPUT' || vnode.elm.nodeName === 'TEXTAREA' || vnode.elm.isContentEditable) {
return vnode.elm
} else {
return vnode.elm.querySelector('input') || vnode.elm.querySelector('textarea') || vnode.elm.querySelector('[contenteditable="true"]')
}
}
return null
},

@sonnb
Copy link

sonnb commented Aug 15, 2022

Just in case someone else looking at this issue: This happens when you have v-if in your inner component (the default slot). For example:

`
<Mentionable..>

<textarea v-if="condition" ... /> ` If the condition is not satisficed, this issue will happen because it cannot look for the required element.

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

4 participants