What is the proper way to declare and utilize a constant list within a component template in NuxtJs?

Can someone help me with using itemList in a template? The itemlist is a static list, but I am unsure of where to declare it and how to export it to the template.

<template>
  <table class="table table is-striped is-narrow is-fullwidth">
    <thead>
      <tr>
        <th>category</th>
        <th>value</th>
      </tr>
    </thead>
    <tbody>
      <tr v-for="item in itemList" :key="item.key">
        <td>{{ item.label }}</td>
        <td>{{ currentBanner[item.key] }}</td>
      </tr>
    </tbody>
  </table>
</template>

<script lang="ts">
@Component({
  name: 'GroupingBannerModal',
})
export default class GroupingBannerModal extends Vue {
  itemList = [
    { key: 'id', label: 'ID' },
    { key: 'source', label: 'ソース' },
    { key: 'agency', label: '代理店' },
    { key: 'media', label: '媒体' },
  ]

  @Prop({ type: Array })
  private lstBannerGrouped!: Banner[]

  private currentBanner: Banner | null = null

}
</script>

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

Element not producing output via Autocomplete from mui/material package

My challenge involves handling an array of states within the Autocomplete component. Once a state is selected, a corresponding component needs to be rendered based on the selection. However, despite successful state selection in the code, nothing is being ...

How to Hide Warning Messages in Angular NPM Package for Production Environment

Seeking advice on a coding issue I'm facing. Currently, I am in the process of creating an npm package for angular / angular material, which involves implementing some checks. If a developer fails to pass a specific argument to my function, the funct ...

Does the Array Splice method always remove an item from the end?

I'm having trouble with deleting an item from an array using Array.splice. It seems to always delete the item from the end instead of where I want it to be removed. I'm working with Vue.js and dynamically adding items to an array, but when I try ...

Discovering how to create two interdependent HTTP requests in separate Vue components

Exploring ways to create 2 dependent HTTP requests in separate components within Vue. I am trying to retrieve data from a session and utilize the subsequent response in all following component requests displayed in router-view. Currently, I'm unable ...

Values that represent half of a donut

Seeking assistance with D3.js. I have created a half-donut component that is designed to receive two values: a value variable and a threshold variable. My goal is to add a cutting arc to the half donut based on the threshold value, which ranges from 0 to 1 ...

Quickly organize your files by placing them into individual folders for each entry

Currently in my project, I am utilizing Vite, Vue3 and TypeScript You can view the structure of my next project here I aim to organize each index.html file, along with its style, script, and assets into separate folders based on input entry Upon runnin ...

Unable to locate 'http' in error handling service for Angular 6

My current project involves creating an Error Handling Service for an Angular 6 Application using the HTTP Interceptor. The main goal of this service is to capture any HTTP errors and provide corresponding error codes. However, my lack of familiarity with ...

Automatically restarting Vue when utilizing fs.writeFile within socket.io

Whenever a client uploads an image, they should use the following code to emit it: var image= { imageData: {base64:dataurl}, } socket.emit("Toserver", image) In Vue, there is always a restart when running npm run dev. On the server side: socket.on(&a ...

Enhancing Type Safety in TypeScript with Conditional Typing within Array reduce()

In my codebase, I've implemented a function named groupBy (inspired by this gist) that groups an array of objects based on unique key values provided an array of key names. By default, it returns an object structured as Record<string, T[]>, wher ...

Parsing error encountered while trying to handle an unexpected token at line 214, character 33. It appears that an appropriate loader is missing to process this particular file type

I've been developing a Typescript React project for the past few months without any issues. However, things took a turn yesterday when I decided to run npm audit fix and npm audit fix --force in order to address some security concerns that appeared ou ...

Error message: Vue warning - The prop "disabled" must be a boolean type, but a function was provided instead

I have this code snippet that I am currently using <v-list-item> <v-btn @click="onDownloadFile(document)" :disabled=getFileExtention >Download as pdf</v-btn > < ...

Limit function parameters to only accept values with matching keys

I am relatively new to using TypeScript and am currently working on a project that involves handling various shapes of data from different sources. My goal is to pass this data to different aggregator classes, with one aggregator class corresponding to eac ...

Adding an external link in the `require()` function within the `src` attribute of an `<img>` tag

I am facing a similar issue to the one described in this question here: Linking to images referenced in vuex store in Vue.js The main difference is that I am dealing with an external link for the src attribute of an img tag, like 'https://....' ...

Can I integrate @types/pkg into my custom library to automatically have types included?

Imagine I am creating a library that utilizes types from the Definitely Typed repository (such as @types/pkg). Would it be feasible for my package to automatically include these types when installed, eliminating the need for consumers to separately instal ...

The best location for storing Typescript files within an ASP.NET Core project

My Typescript app is built on AngularJS 2 with ASP.NET Core, and currently I store my TS files in the wwwroot directory. While this setup works well during development, I am concerned about how it will function in production. I aim to deploy only minified ...

Angular 5: Unable to add a destroyed View to a ViewContainer

I encountered a new error in my Angular application that I haven't seen before. The issue is arising from this specific line in the Angular source code. This error occurs when I log out and then log back into my app. While on a certain route, there i ...

The parameter type '==="' cannot be assigned to the 'WhereFilterOp' type in this argument

I'm currently working on creating a where clause for a firebase collection reference: this.allItineraries = firebase .firestore() .collection(`itinerary`); Here is the issue with the where clause: return this.allItiner ...

When inserting a child element before the myArray.map(x => ) function, it results in rendering only a single child element from the array

Sorry for the confusion in my explanation, but I'm encountering an issue with displaying elements from an array. Here is the code snippet I am working on. Currently, the myArray contains 10 elements. When I place the <LeadingChild/> component ...

Using Typescript to customize the color of Ionic's Ion-checkbox

I am attempting to modify the color of the ion-checkbox using TypeScript <ion-item > <ion-label id="check1">No</ion-label> <ion-checkbox color="blue" id="box1" [(ngModel)]="todo.check1" name="check1"></ion-checkbox&g ...

Is there a way to enforce a mandatory lambda argument?

I am trying to pass a lambda into a function, but I need the lambda to have only one argument. TypeScript correctly generates an error if I provide two parameters to the lambda, however it does not raise any issues if I leave out any arguments altogether ...