Adding an array to Vue-Kanban blocks can be accomplished by following these steps

I have a web application where I am integrating the vue-kanban component. My goal is to showcase certain objects from my database on the kanban board, but I could use some guidance on how to incorporate them into the display.

Below is the array containing the projects:

props: {
  projects: {
    type: Array,
    required: true,
  }
},

Instead of using blocks, I would like to populate the kanban board with these projects. Here's an example snippet of the code:

data() {
  return {
    stages: ['open', 'doing', 'close'],
    blocks: [
      {
        id: 1,
        status: 'open',
        title: 'test',
      },
    ],
  };
}

I am utilizing this component: https://github.com/BrockReece/vue-kanban

Answer №1

Check out this guide on passing props as initial data in Vue.js 2

When the Kanban component requires an attribute like :blocks="[...]", can you simply pass the projects array directly with :blocks="projects" if no changes will occur to the data?

If not, and the data name blocks is necessary and needs to be mutable, follow the example below.

export default {
  name: "YourComponent",
  props: {
    projects: {
      type: Array,
      required: true
    }
  },
  data() {
    return {
      blocks: this.projects
    }
  }
}

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

Struggling to add information to a database table with PHP

Check out the code snippet below: Here is the HTML5 code block: <div class="col-md-8 blogger-right-container"> <form action="blogger_account.php" method="post" role="form" enctype="multipart/form-data"> < ...

Handling validation errors for arrays in jQuery

I am facing an issue with a form containing multiple input arrays, where I only want certain inputs to be mandatory and apply the class "ignore" to some. The problem is that jQuery validate checks all mandatory inputs. How can I avoid this? Here is a simp ...

Node does not recognize the $or operator

Currently, I am enrolled in an online course and facing a problem with a query issue. Interestingly, the query functions perfectly fine in the shell, however, when executing the js file, an error arises stating: unknown operator: $or. Here is the crucial c ...

Is it worth the effort to assign propTypes for mandatory properties repeatedly throughout nested components?

When one component always calls another, but adds some properties, do you use PropTypes for required properties in the calling component even if they are checked in the component being called? Or only at the higher level? To illustrate: const Input = pro ...

Tips for handling Google Spanner Date type in JavaScript

I am facing a challenge with Google Cloud Spanner as I work with multiple tables containing columns of type Date. While inserting entries with specified dates works fine, the issue arises when trying to retrieve these entries in the JavaScript frontend. Th ...

What is the reason for the failure of setting labels.text from an NSMutableArray?

Here is the code snippet: NSMutableArray *textLabels = [[NSMutableArray alloc] initWithObjects:cell.textLabel1.text, cell.textLabel2.text, cell.textLabel3.text, cell.textLabel4.text, cell.textLabel5.text, nil]; for (int i=0; i<json. ...

Vue combined with Grapejs

Currently, I am utilizing Grapejs with Vue and everything appears to be functioning properly. However, I am encountering an issue with the "grapesjs-preset-webpage" library. I am struggling to incorporate additional HTML options, such as "Columns", "Video ...

"Angularjs feature where a select option is left blank as a placeholder, pointing users

Currently, I am working with AngularJS (version < 1.4). When using ng-repeat in select-option, I encounter an extra blank option which is typical in AngularJS. However, selecting this blank option automatically picks the next available option. In my sce ...

Pluck() method in Laravel retrieves a single row instead of a collection

I am currently working on developing a dropdown menu, and in order to achieve this, I require a JSON format with key-value pairs. I attempted to use the pluck() helper function, but it seems to be returning only a single row instead of the expected results ...

Canvas.js graph failing to refresh with updated data

I have encountered an issue while using CanvasJS to generate a line graph with data from Myo. The problem is that when new data is received, the graph fails to update. This may be due to the fact that I did not initially populate the graph with any data po ...

Tips for refreshing a live ajax call to animate a circle

Currently, I am utilizing the gaugeMeter plugin to dynamically display the CPU usage of my elasticSearch Host. While the values are being displayed correctly, there seems to be an issue with the animation of the gauge/circle itself. Instead of the indicato ...

Adding a class to an img tag with TinyMCE

Currently, I am utilizing the TinyMCE editor as a standalone editor in my content management system (CMS). Within the CMS, there is an automatic setting that adds a curved border to any image tags within the cms div ID. In certain cases, I require the op ...

Tips for creating brief animations

I am currently working with a moving div in JavaScript that continues to move for a period of time after the key is released. I am looking for a way to immediately stop the animation upon releasing the key. The animation is controlled by a switch statemen ...

Change the background of the play/stop icon with a jquery toggle

There is a list of video links with play icons as backgrounds in front of them. When a user clicks on a link, the video will start playing in a player located to the left of the links. The clicked link's background icon changes to a 'stop' i ...

Change a Python string in the format 'min:sec' into a time object so it can be displayed correctly and sorted by the jQuery tablesorter

Currently, I am facing an issue where tablesorter is only working correctly on string representations of time that are below '25:00'. Any values above this are being sorted lower than strings like '24:12' or '09:24'. It seems ...

Synchronizing information between different controllers using a service

After reading the discussion on this stackoverflow post, it seems like using services is the recommended way to transfer data between controllers. However, in my own testing on JSFiddle here, I encountered difficulties in detecting changes to my service w ...

When using setState in the onRowSelection event with React's Material-ui tableRow, the selection cannot be properly controlled

Currently, I am working with a material-ui table https://i.stack.imgur.com/JIzLT.png and my goal is to pass selected rows to a function when the DELETE button is clicked. constructor(props) { super(props); this.state = { selecte ...

Utilizing default values with props in Vue.js for customization

There are very few instances where I need to modify the value of props during initialization, for example: props : { columnName : String, setValue: { validator: function (value) { //handle specific cases let _value ...

Guide on inputting Vue component in props

<template> <v-dialog width="auto" v-model="isShown" transition="dialog-bottom-transition" > <v-card> <v-card-title v-if="title"> {{ title }}</v-card-title> ...

Exploring Virtual Reality with the Oculus Quest2 and Three.js

Currently, I am working on a project using Oculus and three.js to create a virtual reality experience. To test the functionality, I decided to try out the official sample provided. Here is the link to the official sample. My intention was to access the s ...