Having trouble importing components in NativeScript Vue?

I am just starting to explore the world of NativeScript and working on my first project using it. I am facing an issue while trying to incorporate a header component into my main App. Unfortunately, when I run the iOS emulator, the header does not appear on the screen.

Here is my App component:

<template>
  <Page>
    <Header :numCorrect="numCorrect" :numTotal="numTotal" />
    <GridLayout columns="*" rows="*">
      <Label class="message" :text="msg" col="0" row="0" />
    </GridLayout>
  </Page>
</template>

<script >
import Header from "./Header.vue";

export default {
  components: {
    Header
  },
  data() {
    return {
      msg: "click me",
      questions: [],
      index: 0,
      numCorrect: 0,
      numTotal: 0
    };
  }
};
</script>

<style scoped>
.message {
  vertical-align: center;
  text-align: center;
  font-size: 20;
  color: #333333;
}
</style>

and my Header component:

<template>
  <StackLayout class="nav" orientation="vertical">
    <span class="title">Quiz App</span>
    <span class="title">Counter : 0/0</span>
  </StackLayout>
</template>

<script>
export default {
  name: "Header",
  props: ["numCorrect", "numTotal"]
};
</script>

<style scoped>
nav {
  background-color: red;
  color: #ffffff;
}
</style>

Despite trying numerous options, I am still unable to get the header to display. Is there something obvious that I might be missing? As a novice in NativeScript, any guidance would be greatly appreciated.

Answer №1

Greetings to all members of the nativescript-vue community. It has come to our attention that the Header component you are utilizing does not contain a valid nativescript element for display purposes. We kindly ask you to replace the <span> tags with <Label> tags in order to rectify this issue:

<template>
  <StackLayout class="nav" orientation="vertical">
    <Label text="Quiz App" />
    <Label text="Counter : 0/0" />
  </StackLayout>
</template>

If you wish to incorporate the props in the counter, you may follow these instructions:

<template>
  <StackLayout class="nav" orientation="vertical">
    <Label text="Quiz App" />
    <Label :text="`Counter : ${numCorrect}/${numTotal}`" />
  </StackLayout>
</template>

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

Error: The function jquery_1.default is not recognized by webpack

I am encountering an issue with using external imports of jQuery in webpack. Despite trying different import syntaxes such as import $ from 'jquery', import * as $ from 'jquery, and const $ = require('jquery'), I continue to receiv ...

Viewing information from the database without the need to refresh the page

HTML <textarea>Enter your question here</textarea><button class="askButton">SUBMIT</button> Upon clicking the button, the question is stored in the database using Ajax, jQuery, and Laravel. However, the question only appears after ...

What is the best way to retrieve past data using RTK Query?

When working with data retrieval using a hook, my approach is as follows: const { data, isLoading } = useGetSomeDataQuery() The retrieved data is an array of items that each have their own unique id. To ensure the most up-to-date information, I implement ...

Vue.js is currently experiencing an issue where the values inside {{ }} are not being displayed, instead, the text is shown

I recently built a vuejs application and executed the npx serve command. After navigating to the appropriate directory and running npx serve, I attempted to access http://localhost:300/myvuefile.html, but all I see is {{count}} inside the button. Here is a ...

MinifyJS - optimize all .js files within a directory

Seeking assistance to finalize my build process: I am currently transpiling es6 > es5 using babel. Once that is complete, I aim to minify all my .js files recursively with uglifyJS solely using NPM scripts (no grunt or gulp). My Requirements; Convert ...

The switch case functionality refuses to change when I interact with the user interface

Can someone please help me troubleshoot? I'm not receiving any errors in the Chrome console. HTML <div class="wrapper"> <i id="repeat" class="fas fa-stop-circle"></i> </div> Javascript const wrap ...

What are some strategies for receiving multiple responses with just one ajax request?

. I am having trouble grasping the concept of using ajax and how to get multiple responses while passing a single request. Can anyone provide me with a sample code to help me understand better? ...

Run a Javascript function when the expected event fails to happen

I currently have this setup: <input type="text" name="field1" onblur="numericField(this);" /> However, I am struggling to figure out how to execute the numericField() function for the element before the form is submitted. I attempted using document ...

Mastering the art of maximizing efficiency with the Jquery Chosen Plugin

Currently, I'm facing an issue with the jQuery chosen plugin due to my large datasets causing the select box to hang and slow down. Below is my implementation of the plugin: var request = $.ajax({ method: "POST", url: "ajaxRequest.php", d ...

The React functional component fails to update when triggered by a parent component's setState method

My React component is utilizing apollo to fetch data through graphql class PopUpForm extends React.Component { constructor () { super() this.state = { shoptitle: "UpdateMe", popupbodyDesc: "UpdateMe" } } re ...

Is it possible to add to the existing class based on a certain condition?

I have a coding challenge that I need help with. I have a set of code where I want to replace the old value in a class named "content" based on certain conditions. If the value within the class matches one of the values in an Array, then I need to append s ...

Challenges arise when utilizing the foundation 6 grid for image overlays within a React application

Having some trouble using the foundation 6 xy grid for the first time and aligning three images with text overlays at the bottom of each image. I am struggling to make the background of the text fill the full width of the image while also ensuring it is re ...

NodeJS has a knack for replying even before the function has completed

Struggling with a NodeJS and Express API for a school project. The getAuthUserId function is not working as expected. It decodes the JWT token to retrieve the user Id from the mongoDB server. However, when calling this function in a REST call "/user/authT ...

How can we ensure that the previous selection is cleared in jQgrid only if the checkbox is not clicked

I've set up a grid with the option for multiselect: true so that I can delete multiple rows at once. When the onSelectRow event is triggered, data related to the ID is loaded and shown to the user. Everything seems to be working fine in this example ...

Node.js and Express constantly face the challenge of Mongoose connecting and disconnecting abruptly

I have been running an Express (Node.js) app connected to MongoDB using Mongoose for a while now. Everything was working smoothly until recently, when it started acting up. It appears that the server is establishing a connection with MongoDB only to disco ...

Node.js: Understanding the issue of a mysterious null value in JSON responses sent to clients

As a beginner in the world of Node.js and JavaScript, I have been struggling to find a solution to my problem even after extensive searching. My current challenge involves sending a JSON object to a Node.js server with an array of 2 elements (longitude an ...

How to choose an item from a dropdown list using its item number with jQuery

Is there a way to select an item in a dropdown menu by its item number using jQuery? <select id="selectbox" style="width: 220px;"> <option value="Option 1">Option 1</option> <option value="Option 2">Option 2</option> < ...

Step-by-Step Guide on Resetting Versions in Package.json

I currently have around 20 react projects, each with their own package.json files. These package.json files contain various packages and their versions: "@material-ui/core": "4.11.4", "@material-ui/icons": "4.11.2", ...

What is the best way to connect a line from the edge of the circle's outermost arc?

I am attempting to create a label line that extends from the outermost point of the circle, similar to what is shown in this image. https://i.sstatic.net/OqC0p.png var svg = d3.select("body") .append("svg") .append("g") svg.append("g") .attr("cl ...

Adding an icon to the Autocomplete TextField in MUI v5 in Reactjs: A step-by-step guide

I created an autocomplete feature with the code below and attempted to display an icon after selecting each item, but unfortunately, it didn't work as expected! import { useState } from 'react' import { TextField,InputAdornment ,Autocomplete ...