Vue.js and Rails 6 are throwing an error stating: "Unidentified custom element: <list>"

I've just set up a new Rails 6 app with Vue.js

Inside app/javascript/app.vue:

<template>
  <div id="app">
    <p>I am the App component</p>
    <list></list>
  </div>
</template>

<script>
import list from './list.vue'

export default {
  name: 'App',
  data: function () {
    return {
      message: "Hello Vue!"
    }
  },
  components: {
    list
  }
}

<style scoped>
p {
  font-size: 2em;
  text-align: center;
}
</style>

Now, in app/javascript/list.vue:

<template>
  <div>
    I am the List Component
  </div>
</template>

<script>
export default {
  name: 'list',
  data: function () {
    return {
      posts: []
    }
  }
}
</script>

With regard to app/javascript/packs/hello_vue.js:

import Vue from 'vue'
import App from '../app.vue'

document.addEventListener('DOMContentLoaded', () => {
  const app = new Vue({
    render: h => h(App)
  }).$mount()
  document.body.appendChild(app.$el)

  console.log(app)
})

However, when I check in the browser, I encounter this error:

vue.runtime.esm.js:638 [Vue warn]: Unknown custom element: <list> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <App> at app/javascript/app.vue
       <Root>

Why is the list component not being found? I've imported it successfully and given it a name.

Answer №1

Following @skirtle's advice, I implemented console.log and discovered that the < img > element was not properly closed

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

Modifying the placeholder text in a Blueprint MultiSelect input field

Is there a way to change the default input text "Search..." in the MultiSelect component from Blueprint Labs? I checked the documentation and the example page, but couldn't find a way to customize the placeholder text. I thought it might be similar to ...

How can information be effectively passed from the controller to Vue.js within the Laravel-Vue.js framework?

This is my first time attempting this approach and I seem to have hit a bump in the road. Although I have successfully set the data in the controller, added the mycourses entry, it doesn't seem to be appearing as expected. The rest of the data is com ...

What is the best way to surround the initial x words within an element with a span tag?

Is there a way to style the first 10 words of a paragraph in a different color when the content is constantly changing? I can't manually add a span in the HTML. My approach involves using JavaScript to iterate through all instances of .overview__text. ...

Are there any equivalents to template literals in the opposite direction?

Template literals make it super simple to create output like this: const age = 22; console.log(`Paul is ${age} years old.`) // => Paul is 22 years old. As I work on extracting information from text, I wonder if there's a way to do the reverse usi ...

Extracting data from a Firebase realtime database JSON-export is a straightforward process that can be

I'm currently working with a Firebase realtime database export in JSON format that contains nested information that I need to extract. The JSON structure is as follows: { "users" : { "024w97mv8NftGFY8THfQIU6PhaJ3" : { & ...

Using Jquery to make an Ajax request to an Asp.net Web Method

My current approach involves using a jquery method to transmit only the member identification # from the client side to the server side. On the server side, I have a traditional Web Method in place to receive the data and execute SQL queries accordingly. ...

Dynamic file name and title for jQuery Datatables Export Buttons

I am utilizing jQuery datatable along with Export buttons. When adjusting the filename and title, I encounter an issue. The problem lies in my desire for the title to be dynamic, depending on the applied filters and custom ones. Additionally, configurin ...

What is the process for iterating through an object in a flatlist using React Native?

I am currently working on developing a Chat list using React Native, and saving the message body in Firebase "real-time". The structure of the database is as follows: { dtnMG3dVEQXL1TPct3awl927jax2: // user key -LmUSeyWtBPqcoN8l6fd: // message ...

Guide to changing the color of SVG images on a live webpage

I'm having trouble changing the color of a specific part within an svg image (created in Inkscape). I believe CSS is the solution, but I can't seem to select the id from the particular SVG file. The object in the SVG has the id='ToChange&apo ...

Trouble with displaying Google line chart on Django platform

I am currently working on a project involving the visualization of COVID data. The idea is that when a user selects a specific state, date range, and output type, the corresponding graph should be displayed using Google API to showcase line charts. However ...

Navigate to the final element of a mapped array

My current project includes a Message component that showcases all messages, whether incoming or outgoing, within a single thread. One feature I am aiming to implement involves ensuring that the most recent message, a freshly typed one, or an incoming mes ...

Can you suggest an efficient method for routing with EJS templates on an Express server without constantly repeating code?

Assuming my app consists of two views: index.ejs and profile/index.ejs, I aim to set up routing using express code as shown below. /* GET home page. */ router.get('/', function (req, res, next) { res.render('index'); }); /* GET pr ...

Guide to setting up page.js

I am eager to incorporate page.js into my project. However, it seems like it requires some type of build system, so I'm not able to locate a single page.js file to include in my page and immediately begin using. page('/',index) Does anyone ...

Turn off the scrolling bars and only allow scrolling using the mouse wheel or touch scrolling

Is there a way to only enable scrolling through a webpage using the mouse wheel or touch scrolling on mobile devices, while disabling browser scroll bars? This would allow users to navigate up and down through div elements. Here is the concept: HTML: &l ...

Steps to making an overlapping sidebar with Bootstrap column

I'm trying to set up a sidebar in Bootstrap that overlaps with a column. The goal is for the sidebar to appear when a button is clicked and disappear when the close button x is clicked. Despite using a Bootstrap row and column layout, I encountered is ...

What are the best circumstances for applying JavaScript in ASP.NET?

As someone who is just starting out in ASP.Net, I have been exploring Validation Controls. However, I am curious about the specific scenarios in which JavaScript would be more appropriate to use. Can anyone provide insight on this? ...

Freemarker substitute & and &ampersand;

I am facing an issue with Freemarker. I need to eliminate all the special characters from this sentence as well as from similar sentences in the future: BLA BLA RANDOM &, RANDOM BLA In particular, I want to remove the & character. The platform ...

What is the method used to create the scrolling effect on this website?

I am in the process of creating my own personal website and I would like it to function similar to the following example: Instead of the typical scrolling, I'm interested in transitioning between different sections on the page. Could this be achieved ...

Utilize three.js to animate a virtual reality humanoid model mapped to skeleton coordinates

As someone who is new to three.js and animation, I find myself struggling with concepts like rotation angles, VRM interactions, and humanoid animations. Despite my confusion, I will do my best to articulate my question below. I have a series of frames tha ...

Removing the final BR elements from a div using jQuery

Does anyone know how to remove only the last <BR> tag within a div using jQuery? The code I tried ends up removing all <BR> tags in the div instead of just the last one. HTML Code <div class="topic"> Lorem ipsum dolor sit amet, consect ...