vue-mention icon indicating copy to clipboard operation
vue-mention copied to clipboard

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

Open dicktalens opened this issue 4 years ago • 3 comments

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!

dicktalens avatar Jan 19 '21 03:01 dicktalens

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".

Niaz-estefaie avatar May 10 '21 07:05 Niaz-estefaie

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 },

zhuxinping avatar Nov 30 '21 02:11 zhuxinping

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..>

` If the condition is not satisficed, this issue will happen because it cannot look for the required element.

sonnb avatar Aug 15 '22 06:08 sonnb