The V-For directive fails to produce any output

I'm brand new to working with vue.js.

I've been attempting to display a v-for in the middle of a table on my webpage, but despite no error messages being shown, my element isn't showing up as intended.

I can confirm that my data is being properly rendered on the page as I can inspect it using the vue.js development tools.

Could someone help point out where I might have made a mistake? If there were any errors reported in the console, I could troubleshoot from there, but unfortunately, it's not providing any feedback.

This is the code I am using:

<template v-for="item in dashboardData.items">
   <tr>
      <td class="position">{}{item.position}}</td>
      <td>{{item.salespersonname}}</td>
      <td>{{item.units_week1}}</td>
      <td>{{item.weeklytargetform_week1}}</td>
      <td>{{item.targetstreak}}</td>
      <td>£{{item.targetsales}}</td>
      <td>£{{item.actualsales}}</td>
      <td>{{item.points}}</td>
      <td>{{item.performancelevel}}</td>
   </tr>
</template>

Additionally, this is my script:

<script>
$.get("https://xxxxx.co.uk/reporting/dashboards/team/detailed/week", function(
  data
) {
  var dataItems = data.items;
  var vm = new Vue({
    el: "#main",
    data: {
      dashboardData: dataItems
    }
  });
});
</script>

Answer №1

When data.items is already assigned to dataItems, attempting to call dataItems.items is similar to calling data.items.items. To resolve this issue, it is recommended to address it early on to quickly resume normal operations...

$.get('https://xxxxx.co.uk/reporting/dashboards/team/detailed/week', function(data) {
  var dataItems = data; 
  var vm = new Vue({
    el: '#main',
    data: {
      dashboardData: dataItems
    }
  });
});

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

What is the best way to retrieve specific JSON data from an array in JavaScript using jQuery, especially when the property is

Forgive me if this question seems basic, I am new to learning javascript. I am currently working on a school project that involves using the holiday API. When querying with just the country and year, the JSON data I receive looks like the example below. ...

Tips for Troubleshooting External Evaluation Scripts

For a specific example, take a look at the haystack.js script from How Big is Your Haystack? I've been searching for a solution and it seems that using the //# sourceURL=name.js comment is the way to go. However, I am struggling with the process of a ...

WebVR - lack of orientation and position data from PositionSensorVRDevice

I'm attempting to enable Oculus Rift DK2 orientation input for WebVR, using either Three.js' VRControls (examples/js/controls/VRControls.js) or directly from the PositionSensorVRDevice. However, the values of orientation and position in the Posi ...

Using Jquery to validate presence of substring in an array

I am currently in the process of validating if any part of the string submitted by users matches an entry in the regions array. Essentially, this jQuery script is meant to verify if the city included in a user's address is one of the cities listed in ...

Tips for extending hover duration in CSS

a:hover + #menu { display: block; position: fixed; } My CSS for a hover effect is causing the menu to disappear quickly once I move the mouse away. What steps can I take to fix this issue? Would utilizing JavaScript provide a better solution, and if so, ...

Advantages of using index.js within a component directory

It seems to be a common practice to have an index file in the component/container/module folders of react or angular2 projects. Examples of this can be seen in: angular2-webpack-starter react-boilerplate What advantages does this bring? When is it recom ...

I'm looking for a way to have an element shift in a particular direction only when two keys are pressed simultaneously

Having trouble moving a square diagonally when two keys are pressed simultaneously. Trying to create an if statement that detects both key presses at the same time and triggers the movement. However, all attempts have failed so far, leaving uncertainty abo ...

Encountering ENOENT error when accessing view file in NodeJS and Express

I've encountered a strange issue with my nodeJS application after refactoring it. The app launches without any problems, the API responds correctly. However, when I attempt to access "/", I receive the following error: Error: ENOENT, stat '/view ...

Change a date and time structure into just the time using JavaScript

I'm faced with a date and time form as shown below: 2021-06-04 11:23:37.000 I am attempting to convert this form to just the time: Post conversion: 11:23:37 Please note that the original form 2021-06-04 11:23:37.000 remains constant. ...

Tips for resolving the issue: 'Unhandled Promise Rejection: Error: Unable to resolve bare specifier "app.js" from http://localhost:3000/'

While delving into TypeScript, I have come across an error related to node modules. https://i.sstatic.net/IPx5A.png Upon clicking the anonymous function, it leads me to the following code snippet. https://i.sstatic.net/4U8dY.png <!DOCTYPE html> & ...

Creating a slider that is reminiscent of the Amazon product slider: A step-by-step guide

I am in the process of building a website, but I lack skills in js and jQuery. I have been searching for days trying to find a library that supports the feature I need - zoom and thumbnails similar to Amazon or eBay product listing slider. However, most of ...

Creating ActiveX's m_hWnd HWND when instantiating an object with InnerHTML

My implementation involves the utilization of the following JavaScript code to generate a new ActiveX object. var playerDiv = document.createElement("div"); playerDiv.style.border = "1px solid red"; var size = 200 + 20 * index; ...

Animating overlapping div elements using jQuery

I am currently using jQuery's animate() function to adjust the size of a "row", but I am facing an issue with a badge that sometimes appears on the row. The problem is that the badge gets hidden during the animation, which doesn't look good. I ha ...

VueJS functions properly on Google Chrome, however it may encounter compatibility issues when using

I am currently working on a VueJs app resembling an auction, with the backend powered by Laravel. Everything runs smoothly when I test it on Chrome, but for some reason, Safari seems to be giving me trouble. The app consists of two main components: Deale ...

Implementing React.JS to dynamically update a value from a websocket and store it within

I want to create a dynamic stock price table that updates with live stock prices using websockets. I have all the necessary data and need to update my stock price object with the live price. How can I access the variable and insert the value into the obj ...

Retrieving data from a stored procedure with XSJS and storing it in a variable

I am currently facing a situation where I need to pass a session user as a parameter to a stored procedure in order to retrieve a receiver value. This receiver value needs to be stored in a variable so that I can use it in another function within an xsjs f ...

Mastering the Art of Dynamically Assigning Types in TypeScript

Recently, I encountered a challenge with wrapper function types. I am looking to convert functions with callbacks into promise-based functions. Most of these functions have a similar structure: func({ success:...., fail:...., complete:... }) So, I ...

Grid layout showcasing masonry gallery

I've spent some time looking for a Masonry gallery with a grid layout, but couldn't find one that suited my needs. So, I decided to create my own. I implemented a customElement with grid layout, but encountered an issue when trying to assign grid ...

What measures do websites such as yelp and urbandictionary implement to avoid multiple votes from unregistered users?

It is interesting to note that on urbandictionary, you do not need to be logged in to upvote a definition. For example, if you visit and upvote the first word, it will record your vote. Even if you open an incognito window and try to upvote again, or use ...

Increase the detection range in empty lists for Vue-draggable-next

I am currently utilizing Vue-draggable-next in conjunction with Vue 3 to enable draggable lists within my application. In certain scenarios, users need to drag items from other lists into lists that are initially empty. I have noticed that the area for det ...