I'm currently working on a VUE application that runs smoothly without any errors, but unfortunately, all I'm seeing is a blank

Whenever I run the Vue app using npm run serve in my command line interface, a blank page is displayed instead of the expected login view. The reason behind this issue baffles me

This file pertains to the SignUp view

<template>
  <div class="container-fluid">

    <div class="row">
      <div class="col-12 col-sm-10 col-md-8 offset-sm-1 offset-md-2">
        <div id="signUp" class="mt-5">

          <form class="border border-primary rounded form-inline" @submit="signUp">

            <h2 class="col-12 text-center text-primary mt-3 mb-5">Sign Up</h2>

            <!-- Form fields for sign up -->

          </form>

        </div>
      </div>
    </div>

  </div>
</template>

<script>

  // JavaScript content related to sign up

</script>

<style scoped>
  // Styling specific to this component

</style>

The following files are part of the src directory.

Main.js

import App from './App.vue'
import router from './router'
import store from './store'

Vue.config.productionTip = false;

// Vue instance creation

router.js

import Router from 'vue-router'
import SignUp from "./views/SignUp";

Vue.use(Router);

// Vue router setup

store.js

import Vuex from 'vuex'

Vue.use(Vuex);

// Vuex store configuration

App.vue

<template>
  <div id="app">
    <router-view/>
  </div>
</template>

<style>
  // Global styles

</style>

I have attempted to include the node_modules file in my project and investigate why this issue occurs in Vue, but the root cause remains elusive.

Answer №1

<router-view/> within your App.vue file is responsible for displaying the component associated with the current route. When you visit your app's URL in your browser (http://localhost:8080/), the current route is /. Since there is no component mapped to the / route, only an empty div is shown. Your one available component is linked to the /registro route. To view your SignUp component, you can either go to http://localhost:8080/registro, or assign the Signup component to the / route as follows:

import Router from 'vue-router'
import SignUp from "./views/SignUp";

Vue.use(Router);

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: "/",
      name: "signup",
      component: SignUp
    }
  ]
})

Alternatively, redirect the / route to /registro:

import Router from 'vue-router'
import SignUp from "./views/SignUp";

Vue.use(Router);

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      redirect: '/registro'
    },
    {
      path: "/registro",
      name: "signup",
      component: SignUp
    }
  ]
})

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

Issue: "unable to locate the specified file or directory" error message encountered while attempting to include a GitLab private repository in the NPM package.json

Trying to include a GitLab private repository in another project's package.json. "dependencies": { "project": "git+https://myusername:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f99e908d95 ...

Vue Component's computed property presentation: [Vue alert]

I recently developed a basic Vue 2 component: Vue.component('upper', { props: ['value'], template: '#upper-template', computed: { formattedValue: function() { return this.value.toUpperCase(); ...

Expanding Image with HTML and CSS: A Guide

In the process of creating my website, I encountered an issue with the logo placement. I wanted the logo to be in the top left corner, similar to the one shown in this image. Initially, everything was working fine until I made some adjustments to move the ...

Effectiveness of jquery for image swapping appears to be problematic

I'm having trouble getting the following code to work in Google Chrome. I believe it should be working, but for some reason it's not. Here is the code: <html> <head> <script type="text/javascript" src="js/jquery_1.7.1_ ...

error: encountering issue with Vue TypeScript Jest tests - '$store' property is undefined

I've been facing issues with my tests failing after a recent npm install. I've tried adjusting versions up and down, but haven't had any success. Interestingly, the $store isn't directly used in any of the components or tests. Despit ...

Unresolved promise rejection in a React application

I attempted to run npm start and encountered the following error message: “(node:4786) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error occurred due to either throwing an error inside an async function without a catch block, or r ...

One issue that may arise is when attempting to use ngOnDestroy in Angular components while rearranging user transitions

Encountered an issue recently with Angular - when the user navigates from component A to component B, component A remains active unless ngOnDestroy is triggered. However, if the user visits component B before going to component A and then leaves, ngOnDes ...

The Jquery function was implemented twice in the code

I am working on a code snippet that creates progress bars for checkboxes. My goal is to have multiple progress bars on the same page. How can I trigger the function uniquely for each div? $(window).load(function(){ $(function() { $("#reminder").progre ...

Steps to retrieve a file following an AJAX request

Is it possible to automatically download a file following an AJAX call? Currently, when I make the AJAX request, it redirects me to the resource instead of initiating the file download. This is the AJAX function I am using: $('.download').click ...

What is the best way to check if an email address already exists in a PHP MySQL database?

Challenge <?php mysql_connect('localhost','root','123456') or die(mysql_error()); mysql_select_db('email') or die(mysql_error()); ?> <?php if(isset($_POST['submit'])) { extract($_ ...

The NAnt command execution causing output distortion

When running a batch file that invokes npm from the command line, I notice clear formatting in the output, like so: ├── <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6a03041e0f181a180f1e2a5a4459445b5a">[email pr ...

"Can you tell me a way to identify variances between two dates displayed in a

I am looking to calculate the differences between two dates. I will input the date values in the text box and want the duration to be displayed in another text box. <script language=javascript> function formshowhide(id) { if (id == ...

First time blur update unique to each user

By using ng-model-options="{ updateOn: 'blur' }", I can delay model updating until the user clicks out of an input field. This helps prevent constantly changing validation states while initially entering data. However, if a user revisits a field ...

Using PHP code to pass a value to JavaScript

I have both PHP and JavaScript code on my page, and I need to retrieve a value from PHP into my JavaScript code. Below is my JavaScript code: <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "Bread ...

When using vue-cli, it does not automatically generate the folder structure

Currently, I am using vue 3.5.1 on my Ubuntu system. Once I installed the latest version by running: npm install -g @vue/cli I proceeded to create a new project with the command: vue create appname However, I noticed that vue only generated two files w ...

Can deleted packages from a private npm repository be recovered?

At my workplace, we utilize a private npm repository to store our projects for easy installation on our applications. While attempting to create a new package today, I mistakenly deleted all of the packages within our organization. Is there a way to revers ...

Understanding the operational aspects of Typescript's target and lib settings

When the tsconfig.json file is configured like this: "target": "es5", "lib": [ "es6", "dom", "es2017" ] It appears that es2017 features are not being converted to es5. For example, code like the following will fail in IE11: var foo = [1, 2, 3].includes( ...

What are the steps to access an Alexa skill through a web browser?

I recently developed an Alexa skill for recipe recommendations. I am wondering if it is possible to have the skill open a browser on my phone and display the recipe when I say, "Alexa, send me the recipe"? The skill is working perfectly in the Alexa devel ...

Encountered a GULP error at internal/child_process.js line 298, throwing errnoException(err, 'spawn')

Up until yesterday, Gulp was working perfectly fine for me. However, today I encountered this error message: internal/child_process.js:298 throw errnoException(err, 'spawn'); ^ Error: spawn EACCES at exports._errnoException (uti ...

Having trouble getting Vue components to load in Symfony?

I am integrating Vue into a Symfony 4 project and have followed all the guidelines I could find. Despite my efforts, I am unable to display any Vue components - I can't even get a console.log statement to run from my app.js file. This is my app.js co ...