Encountering an issue with vue-mention where the error message states that "this.$scopedSlots.default is

// After running "npm why vue"

<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3640435376041800180704">[email protected]</a>
node_modules/vue
  dev vue@"^2.6.12" from the root project
  vue@"^2.5.17" from <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e89e9d8dc58b899a879d9b8d84a8d8c6d9d0c6d8">[email protected]</a>
  node_modules/vue-carousel
    vue-carousel@"^0.18.0" from the root project
  vue@"^2.6.12" from <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8cfaf9e9a1efe3e8e9a1e8e5eaeaccbda2bda2bc">[email protected]</a>
  node_modules/vue-code-diff
    vue-code-diff@"^1.1.0" from the root project
  vue@"^2.2.6" from <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="35434050185e545b57545b75041b0d1b05">[email protected]</a>
  node_modules/vue-kanban
    vue-kanban@"^1.8.0" from the root project
  peer vue@"^2.6.0" from <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="186e6d7d35757d766c717776582936283628">[email protected]</a>
  node_modules/vue-mention
    vue-mention@"^1.0.0" from the root project
  vue@"^2.5.13" from vue-pjax-adapter@undefined
  node_modules/vue-pjax-adapter
    vue-pjax-adapter@"github:riverskies/vue-pjax-adapter" from the root project
  peer vue@"^2.6.0" from <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="730506165e0116001a091633425d435d42">[email protected]</a>
  node_modules/vue-resize
    vue-resize@"^1.0.1" from <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9ee8b3eaf1f1f2eaf7eedeacb0afb0ad">[email protected]</a>
    node_modules/v-tooltip
      v-tooltip@"^2.1.3" from the root project
      peer v-tooltip@"^2.0.0" from <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6d1b180840000803190402032d5c435d435d">[email protected]</a>
      node_modules/vue-mention
        vue-mention@"^1.0.0" from the root project

I am encountering an error stating that this.$scopedSlots.default is not a function when implementing the vue-mention component in my codebase. My current Vue version is "2.6.12".

<script>
import { Mentionable } from 'vue-mention'

export default {
  components: {
    Mentionable,
  },

  data () {
    return {
      text: '',
      items: [
        {
          value: 'cat',
          label: 'Mr Cat',
        },
        {
          value: 'dog',
          label: 'Mr Dog',
        },
      ],
    }
  },
}
</script>
<template>
  <Mentionable
    :keys="['@']"
    :items="items"
    offset="6"
  >
    <textarea v-model="text"/>
  </Mentionable>
</template>

Additionally, I am receiving a prop mutated error for both the keys and items properties. Has anyone else experienced similar issues with Vue components like this? This particular component is crucial for my project.

Answer №1

If you encounter this issue, it may be due to using a component with Scoped Slots. You can learn more about Scoped Slots at https://vuejs.org/guide/components/slots.html#scoped-slots

In essence, the '<Mentionable>' component requires content to render. If 'text' is an empty string, the '<textarea>' element will not display, resulting in an empty slot for Mentionable. To resolve this, consider implementing a conditional v-if="text" statement within the '<Mentionable>' component.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issues with JavaScript switch statement not functioning as expected

JavaScript: let Page = parseInt($(".active_pagination").data("number")); let First = parseInt($(".pagination_number:first").data("number")); let Last = parseInt($(".pagination_number:last").data("number")); alert("Page: "+Page+" First: "+First+" L ...

Having trouble with yarn install? Keep receiving the error message "Other managers are not allowed"?

Recently, I began using the yarn package manager for one of my projects. To get started, I globally installed yarn using sudo npm install yarn -g. However, when attempting to install dependencies with yarn install, I encountered the following message on t ...

Conflicting styles arise when using the makeStyles function from Material UI with imported

In working on a React component library using create-react-library, I have incorporated basic components that utilize Material UI components and the material UI hook-based styles pattern. For example (in a simplified form): // LibraryComponent.js const u ...

Mysterious disappearance of getElementById function in React

This is my first time creating a React class component, but for some reason the id isn't being recognized. import React, { Component, forwardRef } from 'react'; class FilterGroup extends Component { constructor(props) { super(pr ...

Three.js used to create an interactive 3D map

Interested in diving into three.js, but not sure where to begin. Completely new to the concept, yet eager to gain expertise in this subject. The ultimate goal is to create an interactive 3D map with three.js. Seeking guidance and advice on how to get sta ...

Effective URL structure with nested ui-view in AngularJS

It is common knowledge that Angular functions as a SPA (Single Page Application). I am seeking the most effective approach to display a main left-side menu selector page, where clicking on any menu item will load the content in the right-side view div. Th ...

Can you explain the contrast between deep and shallow cloning techniques?

When I employ splice to duplicate an array, I receive a shallow copy. However, there seems to be something missing since I end up with multilevel arrays. It appears that the issue lies elsewhere, possibly not related to the array's depth. Can someone ...

Having trouble with your Discord.js Bot continuously going offline and getting Value errors? Here’s how to resolve it

Why do I keep encountering this error? TypeError: Cannot read property 'size' of undefined at Client.client.on.message (/home/colter/Code/groundskeeper/index.js:38:30) at emitOne (events.js:116:13) at Client.emit (events.js:211:7) at MessageCre ...

The response from the ajax call is still pending

I am currently working on integrating MySQL data (select query) using Spring and MyBatis. I have a controller function that is called via ajax in JavaScript to retrieve the database data. For example: ajax url: /testmysql controller requestmapp ...

Encounter the following issue: Unable to access property '0' due to being undefined

After restructuring my entire Javascript code, I managed to solve the problem with asynchronous calls. However, an error occurs when editing a repair and the server prompts the client for repair information again. The error message displayed is "Uncaught ...

Update the network name in the Axios request

Currently, I am utilizing Axios for handling both GET and POST requests. One question that has been on my mind is how to modify the network name: At present, the name serves as the parameter accompanying each request. However, I ponder whether it's f ...

Retrieving every element within a specific HTML tag

I'm working with the following code snippet: <div id="container"> Lorem ipsum dolor sit amet <p>This is a paragraph</p> <br /> <span>This is a span</span> Lorem ipsum dolor sit amet </div> How can I retrieve ...

Steps for printing a page to the printer only one time

I have created a simple HTML page using PHP that sends content to a printer when a link is clicked using Ben Nadel's print plugin. However, I am facing an issue where I do not want the user to be able to print the page multiple times. I attempted to s ...

The object's texture is not displaying

Seeking Assistance I am a beginner in the realm of Three.js and I am attempting to apply a texture to an imported object. The Issue at Hand Despite numerous attempts, I have been unable to successfully achieve this task. I encounter no errors, but the o ...

Unable to establish a connection between the backend Express API and frontend Next.js and React app for setting cookies on localhost

Trying to save a JWT token in the client's cookies after a login fetch, but encountering an issue. The set-cookie response in the Network tab of dev tools shows the message "This set cookie was blocked because its domain attribute was invalid with reg ...

Obtain the values from controls within the <td> element

I'm experiencing some difficulty creating an array of table cell values because the cells contain controls, not just plain text. $("#tbl_CGT tr").each(function() { var arrayOfThisRow = []; var tableData = $(this).find('td'); if (tab ...

Is it possible to maintain the x-axis in a fixed position while scrolling with d3.js?

I am working with a d3 matrix that has both an x and y-axis. However, my y-axis is quite long, so I want to ensure that the x-axis remains visible even when scrolling. I have tried setting the position attribute to 'fixed' using .style("position" ...

Weird problem with handling dates in JavaScript and PHP

I'm having trouble with dates in JavaScript and PHP. <?php $mydate = date('2012-05-02 17:00:00'); echo 'Today in PHP --'.$mydate; $mytimstamp = strtotime($mydate); echo '<br/>My PHP unix timestamp --'.$mytimst ...

Radio button does not maintain its checked status when selecting a different component

I am facing an issue with my parent component Question <template> <div class="question-container"> <div class="question"> <h2>{{ number }}. {{ question.question }}</h2> <Choice :choice ...

Interact with elements across multiple SVG files using HTML

I have a website that consists of three SVGs. I am now looking to connect elements in these different SVGs by drawing simple lines between them. My goal is to create a line from element1 (#element1) in svg1 to element6 in svg2. Unfortunately, I am unable ...