What is preventing me from importing a component into VUE for a second time?

Here is the project structure:

src
  components
         create.vue
         resume.vue
         service.vue
  shared
         header.vue
         menu.vue
         loader.vue
         footer.vue

This is the Loader component:

<template>
    <div class="three col">
        <div class="loader" id="spinner-2">
          <span></span>
          <span></span>
          <span></span>
        </div>
    </div>
</template>

<script>
export default {
  name: 'Loader',
    
}
</script>

I have imported and implemented the Loader component in my create.vue component. Here's how I did it:

<template>
              <div v-show="formInfo.selectedId != ''">
                <h1 class="title">What's the name of your
                  <span>{{idName}}</span> ?
                </h1>
                <input
                type="text"
                class="form-control"
                v-model="formInfo.name"
                @keypress="onChangeName($event)"
                @keyup="onChangeName($event)"
                />
                <div class="loader-spinner" v-if="loading">
                  <ciev-app-loader>
                </div>
              </div>

</template>
<script>
import Loader from '../shared/loader.vue'

export default {
  data() {
    return {
      step: 1,
      specieName: "",
      breedName: "",
      animalName: "",
      breedId: 0,
      imageSelected: false,
      isFormCompleted: false,
      isBreedSelected: false,
      loading: false,
      isLoaderFinished: false,
      myTimeout: 0
    };
  },
  components: {
    'ciev-app-loader': Loader
  },


Now, I want to reuse the Loader component in my resume.vue component. After importing it and declaring it in the template, the Loader component is not being displayed. Instead, I get an error message in the console:

Looking at other instances of this error, I have made sure to declare the name option when exporting the component, but the issue persists with the Loader component. What could be causing this problem?

Thank you for your assistance.

Answer â„–1

There appears to be a closing tag issue with the <div> element in the resume.vue component. Please fix it before attempting again.


 <div
        v-show="!displayUnknown"
        class="column"
        v-bind:class="{ paymentIsActive: 'payment' === selectedResume }"
        @click="onClickResume('payment')"
      >
        <label>
          <input
            type="radio"
            name="selectedResume"
            value="payment"
            v-model="selectedResume"
          />
          <i class="icon-card"></i>
        </label>

    <div class="loader-spinner">
      <ciev-app-loader />
    </div>
</div>

Answer â„–2

After thorough examination of my code, I discovered that the error was caused by declaring the components object twice: once with the imported component declaration in the script, and again at the end as an empty object. This duplication led to the error message. Appreciate your assistance in resolving this issue.

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

Having Trouble Concatenating Two Parameters in a JavaScript Function

I am attempting to retrieve 2 numbers as arguments for the function saveQuestion, however, I'm encountering an issue. $("#questionRow") .append('<input type="submit" class="btn btn-default" id="saveQuestion' + addSectionCount + & ...

Having issues with JQuery.Ajax() function, not entirely certain if the script is loading correctly

Attempting to utilize an API for sending emails through MailChimp without needing a backend. Unsure if Jquery script file is configured properly. $(document.ready(function () { $('#survey').click(function() { $.ajax({ type: “POSTâ ...

Trouble with highlighting the chosen menu item

I have been attempting to implement this code snippet from JSFiddle onto my website. Although I directly copied the HTML, used the CSS inline, and placed the Javascript in an external file, the functionality does not seem to be working properly. Feel free ...

Ember Gain a comprehensive understanding of the flow of execution between route and controller

Below is a snippet of my "box" route/controller: export default Ember.Controller.extend({ initialized: false, type: 'P', status: 'done', layouts: null, toggleFltr: null, gridVals: Ember.computed.alias('mode ...

Display a different DIV based on the presence of a URL variable, either hiding one or

If the URL contains the word 'email,' I want to hide the <div id="sociallocker"> and display the <div id="emaillocker">. I attempted the following code but it did not work: <script type="text/javascript"> $(function () { ...

Struggling to maintain preventDefault functionality while utilizing a submitHandler, causing the form to bypass and directly access the AJAX PHP

I'm having trouble keeping my AJAX call within the same page. Despite multiple attempts with preventDefault(), the form keeps getting submitted. Below is the complete code for a form with ID "#leadform" and a button with ID "#submitButton". $(docume ...

The significance of constants in CoffeeScript and Node.js

When it comes to maintaining constants in your code, what is the best approach? I've noticed that many developers hard code table names and rows directly into their Coffeescript classes on Github. How should constants like these be stored and shared a ...

I am encountering an issue where the span does not display when I click the button in Vue.js. I am seeking advice on how to troub

I am having an issue with conditional rendering in Vue.js. When I click on the button, the span does not render as it should. How can I resolve this issue? <v-btn icon @click="showInfo = !showInfo"> <v-icon>mdi-dots-vertical&l ...

What is the best method for incorporating card components from Stripe into a Vue.js application?

I am currently facing an issue with implementing Stripe in my Vue.js project. Despite following the documentation provided, I am encountering errors such as "stripe is not defined" and "Uncaught ReferenceError: h is not defined". Initially, I created a pa ...

Step-by-step guide to implementing dynamic field autocomplete using AJAX techniques

Seeking assistance in merging ajax autocomplete with dynamic field input. The autocomplete feature is currently working on the first field, but when adding another field, the autocomplete stops functioning. Any help would be greatly appreciated. Here is t ...

Using JavaScript to round up the number

I need help rounding numbers in a specific way: Value Expected 0,523% 1% 2,235% 2,5% -0,081% -0,5% -1,081% -1,5% How can I achieve this using JavaScript? Possible Solution: static round (num) { const abs = Math.abs(num); const sign = num ...

Utilizing CSS or JavaScript to define the input type

I currently have a group of checkboxes displayed on a webpage within a DIV labeled OPTIONS, shown below: <div id="options"> <input type="checkbox"..... > <input type="checkbox"..... > <input type="checkbox"..... > <input t ...

What is the method to delete an image in JavaScript after a specific period of time has passed since its creation?

I need help figuring out how to make an image disappear on my website after 2 seconds. I've searched online for solutions, but haven't come across anything helpful. function rockImage() { var img = document.createElement("img"); img.src ...

What is the method to view all components within a Vue project displayed in a tree format?

In my extensive Vue 2 project, I have numerous nested components that are used in several places. I am searching for a Visual Studio Code extension that can display a graphical representation of which components are utilized where. Instead of manually lo ...

Need assistance with filling the space between two vertical lines on a chart using the chartjs library?

Can someone help me figure out how to fill the area between two line graphs using chartjs? I know how to do it when one line is on top of the other, but I'm struggling with getting the area between two lines that are side by side. For example, I&apos ...

Preserving color output while executing commands in NodeJS

My Grunt task involves shelling out via node to run "composer install". var done = this.async(); var exec = require('child_process').exec; var composer = exec( 'php bin/composer.phar install', function(error, stdout, stderr) { ...

Retrieving JSON Data from an API with JavaScript/jQuery

Having some trouble with JSON parsing using jQuery and JavaScript. I'm trying to fetch weather information from the open weather simplest API, but for some reason it's not working. When I hardcode the JSON data into a file or my script, everythin ...

Error: Failed to execute 'toLocalDateString' on (intermediate value); Function does not exist in Stats.js at line 62

function Statistics() { const [clientList, setClientList] = useState([]); //store all the information of the database in a list //make an axios request to fetch information from database const getClients = () => { Axios.get("http://localhost:3 ...

Ensure prototype is easily accessible within vuex

Within my app.js file, I implemented a functionality to enable translation in Vue: Vue.prototype.trans = string => _.get(window.i18n, string); This feature works perfectly when used in my Vue files: {{ trans('translation.name') }} However, ...

Transferring information from one page to the next

How can I efficiently transfer a large amount of user-filled data, including images, between pages in Next.js? I've searched through the Next.js documentation, but haven't found a solution yet. ...