Contingent upon Blade migrating to Vue.js 2

I want to convert the conditional code provided below into vue.js syntax

<div id="app">
    <table>
        <tr v-for="(sintese, index) in sinteses" :key="index">
            <td v-if="index % 10 === 0 && index !== 0"></td>
            <td>
                <label class="btn btn-primary">
                    <input type="checkbox" autocomplete="off" name="chksintese" :id="sintese.cod_sintese_conversa">
                    <span class="glyphicon glyphicon-ok"></span>
                    {{sintese.descricao}}
                </label>
            </td>
        </tr>
    </table>
</div>

Answer №1

before binding to the table, data can be managed skillfully

new Vue({
    el: '#table',
    computed:{
        newItems: function (){
            var tempItem = [];
            var slice = 10;
            for (var i = 0; i < this.it.length/slice; i++) {
                tempItem.push(this.it.slice(i*slice, slice*(i+1)));
            }
            return tempItem;
        }
    },
    data: {
        it: [{"cod_sintese_conversa":"cod_sintese_conversa1","descricao":"descricao1"},{"cod_sintese_conversa":"cod_sintese_conversa2","descricao":"descricao2"},{"cod_sintese_conversa":"cod_sintese_conversa3","descricao":"descricao3"},{"cod_sintese_conversa":"cod_sintese_conversa4","descricao":"descricao4"},{"cod_sintese_conversa":"cod_sintese_conversa5","descricao":"descricao5"},{"cod_sintese_conversa":"cod_sintese_conversa6","descricao":"descricao6"},{"cod_sintese_conversa":"cod_sintese_conversa7","descricao":"descricao7"},{"cod_sintese_conversa":"cod_sintese_conversa8","...

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.10/vue.js"></script>
<table id="table">
    <div class="btn-group" data-toggle="buttons">
        <tr v-for="items in newItems">
            <td v-for="item in items">
                <label class="btn btn-primary">
                    <input type="checkbox" autocomplete="off" name="chksintese" :id="item.cod_sintese_conversa">
                    <span class="glyphicon glyphicon-ok"></span>
                    {{item.descricao}}
                </label>
            </td>
        </tr>
    </div>
</table>

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

Display or conceal elements in a v-for select input by leveraging the value of another input with Vue3

In my form, I have two dropdown select option fields generated using loops from predefined constants. One dropdown is for selecting different "sides" and the other for choosing various "caps". When a user selects "2-Sided" in the sides dropdown, I want t ...

Exploring Pastebin with Python (Parsing JavaScript-driven websites)

I'm currently encountering an issue when attempting to crawl JavaScript-rendered pages. My approach involves using the python-qt4 module and following a tutorial available at: While the tutorial works flawlessly with the example page provided at: I ...

All promises in the Promise.all() function are resolved instantaneously

I am currently attempting to execute a series of actions after uploading multiple images, utilizing Promise.all. However, I have noticed that the code following the then statement is running before the dispatched code. Where am I going wrong in my unders ...

How can I implement BoxHelper on an Object3D containing children in Three.js?

I am exploring the possibility of using the THREE.BoxHelper to generate a bounding box for an Object3D that has children. My goal is to render a wireframe bounding box for the object while omitting diagonals on the box's faces. Upon inspecting the sou ...

The initial row's Id will be used as the Id for all subsequent rows within a JSON object

After dragging a tr in a table and confirming by clicking a button, I need the order list to be updated in the database. To achieve this, I created a JSON object where I intend to save the ids and their corresponding new orders. The issue I am facing is t ...

I am currently working on creating a shopping cart that includes a delete button for removing items with just a click

I am currently working on developing a shopping cart feature that includes a remove button to delete items when clicked. I have achieved this using the filter method. However, I am facing an issue where after deleting an item and then adding it back, the ...

The error message 'ReferenceError client is not defined' is indicating that the

I'm currently attempting to retrieve the id of clients connecting to my socket.io/node.js server by following the method outlined in the top response on how to get session id of socket.io client in Client. However, I am encountering an error message: ...

Utilizing Laravel's Eloquent to retrieve interrelated data from tables through foreign keys

I am looking to retrieve fields from a controller using Eloquent with the data of another class through foreign keys. I am unsure if this is possible or not. The situation Model Job class Job extends Model { use HasFactory; /** * The attr ...

Initiate a fetch request in React to an external API upon clicking a card

Just a quick question, I'm trying to implement a fetch request in my app that should only happen after clicking on a card. However, I'm having some issues as the fetch request is happening every time instead of just when clicked. useEffect(() ...

Automatically update and reload Express.js routes without the need to manually restart the server

I experimented with using express-livereload, but I found that it only reloaded view files. Do you think I should explore other tools, or is there a way to configure express-livereload to monitor my index.js file which hosts the server? I've come ac ...

Persist the configuration settings of Data tables (such as ColReorder and ColVis plug-ins) by saving and loading them from a database

Does anyone know if it's possible to save and load the states of Data tables (such as ColReorder, ColVis plug-ins) to/from a database? I've tried implementing this, but I'm still facing difficulties. Below is my code for loading the states f ...

Visualize data retrieved from a third-party website through scraping in a chart

After attempting to extract data from a website's data.asp file (formatted in json) and display it as a chart on my site using Google Chart API or FusionCharts, I'm facing issues. Although I can retrieve the json data, it doesn't render as a ...

CSS modal does not extend to the full height of its parent container

I am trying to make the popup modal take up the full height, but it is not happening when there is overflow. The popup appears when the user clicks on a card. Below are images showing how the behavior differs when clicking a card with and without scroll. ...

Utilizing JavaScript Plugin to Fix Image Source URLs in Incorrect Directories

I'm struggling and really in need of some assistance. The issue I'm facing is with a plugin that has a JavaScript file containing an array of URLs pointing to a "texture" directory within the plugin for images. However, I keep encountering 404 e ...

I encountered an error in my Vue CLI project despite having worked on numerous Vue projects in the past

Issue: 'C:\Users\Karim\Desktop\vue project 2020\image-new-project\node_modules\colorette' does not have a valid exports main View error image This is a blockquote ...

Having several bootstrap modals on a single webpage

Bootstrap Modals are featured on my landing page. I have numerous bootstrap buttons with various data targets and modals. The content within the modal needs to be displayed based on the button's data target, linked to the modal via its ID. How can I ...

What is the process of removing a record in Laravel 5.3 with an AJAX query?

I am attempting to use AJAX to delete a record in Laravel 5.3, and I understand that this is a common issue with several solutions available online. Despite trying different approaches, I keep encountering the error NetworkError: 405 Method Not Allowed. I ...

Unable to retrieve data from MongoDB

I have a MongoDB API returning data in my Node.js application. Although the database contains values, I am unable to retrieve them using the API. Here is my model: const mongoose = require('mongoose'); mongoose.set('useCreateIndex', ...

Having trouble parsing FormData in the django backend

Greetings everyone! I hope you are all doing well. I've been working on a custom form that needs to be sent to the Django backend using an AJAX request. The challenge I'm facing is that when I wrap the form into FormData, it works fine on the fro ...

Executing AjaxStart in a JavaScript file for a specific page selection

Seeking advice on how to restrict access to an ajaxStart function in a JavaScript file to only certain pages. The code snippet below shows the current implementation: $(document).ready(function() { $(document).ajaxStart(function() { $("#o ...